You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the getWindowName method returns a window name (if non-empty) or a handle
the getWindowNames method returns a window name (if non-empty) or a handle array
the switchToWindow can switch windows by a name/handle, but needs to iterate/focus over each window to determine the handle by its name
The downside of the proposed implementation
All windows need to be iterated to retrieve their name, which:
can be slow when lots of windows are opened (these websites exist?);
when the website has a JavaScript code that closes a window upon focus loss, then iteration can be very bad.
When the window is renamed after opening, then window name obtained by the getWindowName or getWindowNames would produce NoSuchWindow exception, when given to the switchToWindow method
Technical limitations
name
or byhandle
(see https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidwindow)handle
only (see https://www.w3.org/TR/webdriver2/#switch-to-window)Switching windows by a handle
Switching windows by a name
Current implementation
getWindowName
method returns a handlegetWindowNames
method returns a handles arrayswitchToWindow
on Selenium 2 can switch windows by name/handle (see Technical limitations above)switchToWindow
on Selenium 3 can switch windows by a handle only (see Technical limitations above)Proposed implementation
See minkphp/MinkSelenium2Driver#384 .
getWindowName
method returns a window name (if non-empty) or a handlegetWindowNames
method returns a window name (if non-empty) or a handle arrayswitchToWindow
can switch windows by a name/handle, but needs to iterate/focus over each window to determine the handle by its nameThe downside of the proposed implementation
getWindowName
orgetWindowNames
would produceNoSuchWindow
exception, when given to theswitchToWindow
methodComments from contributors
In the https://github.com/minkphp/MinkSelenium2Driver/pull/384/files#r1501886088 @uuf6429 proposed to replace window name support with window handle support Mink-wise. Considering, that Selenium-based drivers are the only ones that support window operations now.
In the https://github.com/minkphp/MinkSelenium2Driver/pull/384/files#r1501840465 @mvorisek explained window handle workflow like this:
I personally like the proposed implementation, because:
The text was updated successfully, but these errors were encountered: