WebDriver has an inbuilt library for handling the JavaScript alerts, and capturing values from the dialogs. It has a class called Alert. The following actions can be captured by using a Alert class build in latest version of WebDriver
1. accept()
2. dismiss()
3. getText()
4. sendKeys()
1. accept()
This method can be used to click 'OK' button in a popup.
Ex:
1. accept()
2. dismiss()
3. getText()
4. sendKeys()
1. accept()
This method can be used to click 'OK' button in a popup.
Ex:
Clicking on OK for JavaScript Alert |