Reputation: 149
As per Selenium WebDriver documentation we can pass either name Or Handle to driver.switchTo().window(nameOrHandle); To get handle we have getWindowHandle. How to switch on new window based on window name? How to get current Window Name?
/
** * Switch the focus of future commands for this driver to the window with the given name/handle. *
* See W3C WebDriver specification * for more details. * * @param nameOrHandle The name of the window or the handle as returned by * {@link WebDriver#getWindowHandle()} * @return This driver focused on the given window * @throws NoSuchWindowException If the window cannot be found */ WebDriver window(String nameOrHandle);
Upvotes: 1
Views: 975