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 title

Many a times developers don't assign the name attribute to pop-up windows. In such cases, we can use its window handle attribute. However, the handle attributes keep changing and it becomes difficult to identify the pop-up window, especially when there is more than one pop-up window open. Using the handle and title attributes of the page displayed in a pop-up window, we can build a more reliable way to identify the pop-up windows.

In this recipe, we will use the title attribute to identify the pop-up window and then perform operations on it.

How to do it...

We will create a test that retrieves the handles of all the open windows in the current driver context. We will iterate through this list ...

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