Selenium WebDriver : How to Handle JavaScript Alerts and Prompts


Selenium 2 provides Alerts API, to work on pop & alert window –
// Get a handle to the open alert, prompt or confirmation
Alert alert = driver.switchTo().alert();
// Get the text of the alert or prompt
alert.getText();
// And acknowledge the alert (equivalent to clicking “OK”)

Comments

Popular posts from this blog

Testing Webservice with SoapUI Having Windows Authentication

How to Re-run Failed Scenarios in Cucumber