How do you handle Alerts and Pop Ups?

Answer Posted / annasaheb

To Handle Alert

Alert alert = driver.switchTo().alert();
message = alert.getText();
alert.accept();//to accept alert
alert.dismiss();//to cancel alert

Is This Answer Correct ?    19 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by the assertion in selenium?

579


What are the types of listeners in testng?

1103


What is the main difference between the close() and quit() methods?

519


How is a statement different from verification?

579


What is parameterization in testng? How to pass parameters using testng.xml?

554






What is testng assert and list out some common assertions supported by testng?

567


What the webdriver supported mobile testing drivers do you know?

568


What are its advantages of pom?

595


Can captcha and bar code reader be automated by using selenium?

543


Is there a way for me to know all available options when I start selenium server?

560


How you can use recovery scenario with selenium?

603


What are soft assert and hard assert in selenium?

524


Mention what are the advantages of using git hub for selenium?

571


Mention why do you need session handling while working with selenium?

595


Mention what is intellij?

597