sunil kumar sunil kumar - 1 year ago 95
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

3) Code:

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

Nothing is working. Anybody have any ideas?

Answer Source

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download