O'Reilly logo

Selenium Testing Tools Cookbook by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Identifying and handling a pop-up window by its name

In Selenium WebDriver, testing pop-up windows involves identifying a pop-up window, switching the driver context to the pop-up window, then executing steps on the pop-up window, and finally switching back to the parent window.

The Selenium WebDriver allows us to identify a pop-up window by its name attribute or window handle and switching between the pop-up window and the browser window is done using the Webdriver.switchTo().window() method.

In this recipe, we will identify and handle a pop-up window by using its name attribute. Developers provide the name attribute for a pop-up window that is different from its title. In the following example, a user can open a pop-up window by clicking on the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required