✔ Prompt Alert: How To Switch, Get Text, Send Keys And Accept | (Video 51)
How To Switch, Get Text, Send Keys And Accept A Prompt Alert via Selenium –
► Confirmation Alert https://youtu.be/oLKhTuvs76s
► Information Alert https://youtu.be/RR4OJGrK-44
► Download Code, Transcript, and Presentation https://www.rexjones2.com/switch-to-alerts/
► Documentation via GitHub https://github.com/RexJonesII/Selenium4Beginners
Free Selenium Book
► Free Selenium PDF Book: https://www.rexjones2.com/book-selenium-4-beginners/
► Free Java PDF Book: https://www.rexjones2.com/book-part-1-core-java/
► All Paperback & eBooks: http://tinyurl.com/Rex-Allen-Jones-Books
► All Videos On LinkedIn https://www.linkedin.com/company/28599523/admin/
► All Videos On YouTube https://www.youtube.com/channel/UCBU_TzaPsDXXeQ3ItUYKaJg/videos
► All Videos On Facebook https://www.facebook.com/pg/Selenium-4-Beginners-2051994988170815/videos/?ref=page_internal
► Free Java PDF Book: http://tinyurl.com/Part-1-Java-4-Selenium
► All Paperback & eBooks: http://tinyurl.com/Rex-Allen-Jones-Books
► Transcript
Last, we are going to switch, get text, send information then accept the alert.
The 3rd button is the Prompt Alert. We see an entry box for us to write information: Selenium Switch and click OK. The result shows “You entered: Selenium Switch”. After switching to the alert, getting text from the alert and sending text to the alert is similar to the WebElement. In this case, we will use the Alert Interface.
Change the list item from 1 to 3 so we can click the Prompt Alert button. Wait for the alert to become present and sleep for 2 seconds. Pausing our Test Script will help us see the Prompt Alert. However, this time we must separate the switch to alert and accept method. Start by writing the Alert interface and alert object reference equals driver.switchTo().alert. This switches to the alert. Import the alert. Now, get the text.
We write alert.getText() and send keys by writing alert.sendKeys(“I Am An Automation Engineer”). The last step is to click the OK button by writing alert.accept(). I almost forgot to print the Alert. sysyout and Place alert.getText() inside sysout. Let’s Run.
switchToPromptAlert PASSED and it shows the print statements “I am a JS prompt” and “You entered: I Am An Automation Engineer”. That’s it for switching to a Prompt Alert, getting the text and sending text to the alert.
#SeleniumTraining #SeleniumAutomation #BeginnerSeleniumTutorials #SeleniumWebDriver
Видео ✔ Prompt Alert: How To Switch, Get Text, Send Keys And Accept | (Video 51) автора JavaScript и HTML/CSS
Видео ✔ Prompt Alert: How To Switch, Get Text, Send Keys And Accept | (Video 51) автора JavaScript и HTML/CSS
Информация
29 ноября 2023 г. 14:07:39
00:03:41
Похожие видео