Skip to content

Identification of 'main' window should be done via window handle #213

@bmannix

Description

@bmannix

There is a convenient way of switching back to the main window using the Select Window keyword in Selenium2Library by providing a string main rather than a real locator. (The main value results in {"name":""} on the WD wire protocol.)

This has worked great thus far, however I recently ran into an issue using the keyword in this way with GhostDriver. Assuming the issue was with GhostDriver, I opened an issue against the project (https://github.com/detro/ghostdriver/issues/210).

However, after some additional discussion with Simon Stewart (@shs96c) he explained that while the WebDriver spec was intentionally left ambiguos in this area, the correct way of identifying windows is via the unique window handle itself. There is the potential for non-determinism if Window Title or Window Name are used because there might be duplicates.

Regarding how to implement this change, I am not sure what to suggest at this point. Potentially, storing the original window handle when a browser session is initiated, maybe. I'll dig into the S2L code a bit more in the coming days and hopefully suggest a good solution and possibly send a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions