From the course: Selenium Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Switch to alert

Switch to alert

- [Instructor] In this video, I'll demonstrate how to automate opening an alert, switching to an alert, and then closing it. To start with, I'll show how the functionality for the open alert button works. So from the Switch Window page, I can click open alert which opens a browser alert that says this is a test alert and pressing OK closes that alert. So now let's write a test to automate this functionality. I'll start by opening the exercise file for this video. From the IntelliJ window, I'll select open and navigate to chapter two 02_06 and I'll open the start directory. Once the project is open, I will go to build, build project, and wait for that to finish. Once compilation is successful, I can go ahead and automate the steps to my test. So after navigating to the Switch Window page on line 14, I'll start filling in the steps for the test. So let's hop back over to the Switch Window page and what I'll want to do is to inspect the open alert button and I'll go ahead and grab the id…

Contents