I have two button with text "x" and they both have same cssSelector a.aui-button.aui-button-link.aui-restfultable-delete.aui-restfultable-delete-small
The code below is able to click on the first "x", however fails because there is a pop up window asking for confirm to delete.
I want the code to click on first "x" and than click on "Delete" to confirm on the pop up window and repeat for the second "x". The cssSelector for "Delete" in Pop up window is aui-button.js-confirm-action-button
E.g. (Screenshot)
//Delete all existing Request Types
List<WebElement> allele = driver.findElements(By.cssSelector("a.aui-button.aui-button-link.aui-restfultable-delete.aui-restfultable-delete-small"));
// Looping through the elements using for-each loop
for(WebElement eachEle : allele) {
// Checking whether the element is enabled or not
if(eachEle.isEnabled()) {
eachEle.click();
}
}
Any Suggestion how can I write code to do this? Check Image here to get an idea of what I am trying to do Example Image