October 2018
Intermediate to advanced
192 pages
5h 12m
English
Selenium has to be explicitly told which window to focus on. In this case, it has focused on the first parent window. We switch windows in Selenium using the switchTo() command, which is invoked on the driver object. The signature of switchTo is driver.switchTo.window(String). The switchTo() method is in the WebDriver interface, which returns an object of the TargetLocator interface: a child interface of WebDriver. On this object of TargetLocator, the window method is invoked and this returns a WebDriver object. The parameter is of a string type, which is the alpha-numeric handle of the window. Let's handle the small issue in our code by adding switchTo().window(String) at two places in our code right after ...
Read now
Unlock full access