Handling Alerts
- When the Alerts are displayed, they won’t allow you to perform any other operation on the website
- Practical Demonstration
- UnhandledAlertException will be displayed
- Same exception will be displayed if you close the browser without handling the alert.
- Types of Alerts
- Information Alert – hdfc netbanking
- Confirmation Alert – hdfc netbanking
- Prompt Alert – internet herokup
- Handle Information Alerts using the Alert Interface
- Practical Demonstration – internet heroku
- Click on the button to display alert
- We cannot inspect or perform operations on the alert by default
- Switch to the displayed alert using switchTo().alert() of WebDriver interface
- Read the text on the alert using getText() method of Alert interface
- Accept the alert using accept() method of Alert interface
- Dismiss the alert using dismiss() method of Alert interface
- Perform some operation on the web page now or close the browser window.
- We won’t get any UnhandledAlertException now
- Waiting for an Alert using isAlertPresent()
- Practical Demonstration
- NoAlertPresentException
- Practical Demonstration
- Handling Confirmation Alerts
- Practical Demonstration – Internet Heroku
- Handling Prompts
- Practical Demonstration – Internet Heroku
Handling Authentication Pop-up
- driver.get(“http://admin:[email protected]/basic_auth”);
Handling Application Web Push Notifications (Permission Pop-ups)
- ChromeOptions options = new ChromeOptions();
- options.addArguments(“–disable-notifications”);
Handling Bootstrap Model Dialogs
Handling Lightbox
Handling Accept all cookies dialog
By,
Arun Motoori