How can I use switchTo().Window in LT?
Hey Alex,
-
Get the handle of the parent window using the command: String parentWindowHandle = driver.getWindowHandle();
-
Print the window handle of the parent window.
-
Find the element on the web page using an ID which is an element locator.
-
Open multiple child windows.
-
Iterate through child windows.
-
Get the handles of all the windows that are currently open using the command: Set allWindowHandles = driver.getWindowHandles(); which returns the set of handles.
-
Use the SwitchTo command to switch to the desired window and also pass the URL of the web page.