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 ...
Get Selenium Testing Tools Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.