How to Handle Alerts,Confirmation Box and Popups in Selenium Like a PRO?
Pramod Dutta
Posted on September 29, 2020
β Join us - https://sendfox.com/thetestingacademy
In this video, We are going to learn How To Handle Alerts in Selenium and How To Popups Alerts in Selenium, I am going to show step by step How to handle them with accept, dismiss and send Keys methods provided by Selenium.
π Download code : https://codeshare.io/5wXoVK
π Reference Link - https://medium.com/@madhankumaravelu93/selenium-cheat-sheet-a-comprehensive-list-of-selenium-commands-fa4c5c9d11ab
π What is Javascript Alert?
One useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen.
With just accept button information
π Handling Confirm Box in Selenium
A confirm box is similar to an alert, except the user can also choose to cancel the message
A confirm box is often used if you want the user to verify or accept something.
When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed.
If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false.
π What is Prompt Box and How to handle it in Selenium?
A prompt box is often used if you want the user to input a value before entering a page.
When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.
If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null.
Source - https://www.w3schools.com/js/js_popup.asp
Prompt Box
Confirm + they also include a text input.
Alert alert = driver.switchTo().alert();
alert.accept();
alert.dismiss();
π Demo Website Used - https://the-internet.herokuapp.com/javascript_alerts
π What is Automation Testing?
Automation testing is a Software testing technique to test and compare the actual outcome with the expected outcome.
This can be achieved by writing test scripts or using any automation testing tool.
π What is Test automation?
Test automation is used to automate repetitive tasks and other testing tasks which are difficult to perform manually.
πWhy we do Automation Testing?
- Eliminate the manual efforts
- Ad hoc Test- cases are required to run.
- Rerun the critical or important cases continuously.
- Long manual flows are tidies
πWhat is 30 Days of Automation in Testing Challenge?
This video is part of 30 Days of Automation in Testing Challenge. Where we will learn about the different concepts related to Automation Testing for Beginners and topics like
β
Automation testing features
β
Approaches to automation testing
β
What is Automation testing
β
Why automation testing
β
Automation testing frameworks
β
Automation testing advantages
β
Automation testing benefits
β
Automation Testing Tools
β
Automaton Testing Books.
β
Why you need automation testing.
β
What is UI Testing
β
Top Automation blogs to read.
β
Automation tutorials included Selenium, Cypress, Katalon Studio and Test automation frameworks and may more concepts.
β
API Testing using Postman -
https://www.learnapitesting.com
β
Cypress Tutorial with LIVE Projects -
https://cypresstutorial.com
β
REST API testing with Python -
https://masterapitesting.com
#seleniumtutorial #thetestingacademy #seleniumframework #seleniumjava
seleniumforbeginner
Posted on September 29, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.