sunil kumar sunil kumar - 1 month ago 9
AngularJS Question

How to handle AngularJS pop with Selenium WebDriver?

NeoEdify Warning Popup

I'm trying to automate an AngularJS-based website and I am finding lots of popups which I am unable to handle. I have tried:

1) Code:

Alert alert = driver.switchTo().alert();

alert.accept();//Closes OK Button"


2) Direct clicking confirm button with
Xpath
.

3) Code:

driver.executeScript("$x(\"calss=btn btn-lg btn-warning-fill ng-binding']\")[0].click()");


Nothing is working. Anybody have any ideas?

Answer

WebElement element = driver.findElement(By.xpath(".//*[@id='alert-warning']/div/div/div/div[3]/div/a[‌​2]")); ((JavascriptExecutor) driver).executeScript("arguments[0].click()", element);

working

Comments