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 ...

Get Selenium WebDriver 3 Practical Guide - Second Edition 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.