user2085714
user2085714

Reputation: 149

How to find window name in selenium WebDriver?

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

Answers (1)

Sergey Demyanenko
Sergey Demyanenko

Reputation: 46

Name is title of web page.

WebDriver.getTitle()

Upvotes: 0

Related Questions