How to handle Alerts in Selenium

Will use switchTo() method. Please check the below scenarios.

      • void dismiss() // To click on the ‘Cancel’ button of the alert.


      • void accept() // To click on the ‘OK’ button of the alert.


      • String getText() // To capture the alert message.


      • void sendKeys(String stringToSend) // To send some data to alert box.


Default Asked on May 4, 2018 in Software Testing.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.