power_settings_new

how to handle alerts in selenium webdriver java

by
asked
0 votes
143 views
How do I handle alerts in Selenium WebDriver Java, especially the alerts which occurs unexpectedly.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (327 points)
selected by
0 votes
 
Best answer
To handle alert you can use below code.

driver.switchTo().alert().accept();
add
...