WebDriver Alert and Prompts access
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
alert.accept(); // Accepting alert . Like clicking on OK button.
alert.dismiss(); // Dismiss alert . Like clicking on cancel button.
alert.sendKeys(Keys.BACK_SPACE); // Send keys. Example in my case i am sending backspace.
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
alert.accept(); // Accepting alert . Like clicking on OK button.
alert.dismiss(); // Dismiss alert . Like clicking on cancel button.
alert.sendKeys(Keys.BACK_SPACE); // Send keys. Example in my case i am sending backspace.
No comments:
Post a Comment