Explain me how to Handle Alerts in Selenium WebDriver?
Submitted by: MuhammadHere are a few methods of Alerts handling which are widely used in Selenium Webdriver.
☛ void dismiss() is used to click on the 'Cancel' button of the alert.
☛ driver.switchTo().alert().dismiss();
☛ void accept() is used to click on the 'OK' button of the alert.
☛ driver.switchTo().alert().accept();
☛ String getText() is used to capture the alert message.
☛ driver.switchTo().alert().getText();
☛ void sendKeys(String stringToSend) is used to send some data to alert box.
☛ driver.switchTo().alert().sendKeys("Text");
Submitted by: Muhammad
☛ void dismiss() is used to click on the 'Cancel' button of the alert.
☛ driver.switchTo().alert().dismiss();
☛ void accept() is used to click on the 'OK' button of the alert.
☛ driver.switchTo().alert().accept();
☛ String getText() is used to capture the alert message.
☛ driver.switchTo().alert().getText();
☛ void sendKeys(String stringToSend) is used to send some data to alert box.
☛ driver.switchTo().alert().sendKeys("Text");
Submitted by: Muhammad
Read Online Automation Job Interview Questions And Answers
Top Automation Questions
☺ | What is Selenium? |
☺ | Tell me does the Selenium have any limitations? |
☺ | Tell me what is an Absolute XPath? |
☺ | Explain me what the WebDriver supported Mobile Testing Drivers do you know? |
☺ | Tell us what is the alternate way to click on login button? |
Top Testing Categories
☺ | Manual Testing Interview Questions. |
☺ | Rational TestSuite Interview Questions. |
☺ | QTP Interview Questions. |
☺ | Database Testing Interview Questions. |
☺ | Software QA Interview Questions. |