Switching among windows
First, we will see a code example for handling multiple windows. For this chapter, there is an HTML file provided with this book named Window.html. It is a very basic web page that links to Google's search page. When you click on the link, the Google's search page is opened in a different window. Every time you open a web page using WebDriver in a browser window, WebDriver assigns a window handle to that. WebDriver uses the window handle to identify the window. At this point, in WebDriver, there are two window handles registered. Now, on the screen, you can see that the Google's search page is in the front and has the focus. At this point, if you want to switch to the first browser window, you can use WebDriver's ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access