Skip to content

'no such window' due to windowmanager.py/_select_matching() #390

Closed

Description

@divfor

'no such window' exception will be received if a test calls select window by name/title right after a 'close window' call. it is due to _select_matching() calls get_current_window_handle() which is undefined after 'close window' call, this can be found in http://www.w3.org/TR/webdriver/#defining-window-and-frame,

6.4 Close Window
The close command closes the window that commands are currently being sent to. If this means that a call to get the list of window handles would return an empty list, then this close command must be the equivalent of calling "quit". That is, if the final window of a session is closed, then the session quits.

Once the window has closed, future commands must return a status code of no such window until a new window is selected for receiving commands.

so the right way is to skip ' browser.switch_to_window(starting_handle)' if catch this exception.

another work around is simply append below to _browsermanagement.py -> def close_window(self):
handles = self._current_browser().get_window_handles()
if len(handles) >= 1:
self._current_browser().switch_to_window(handles[-1])

Activity

  1. just-be-dev commented on May 11, 2015

    @just-be-dev
    Contributor

    @divfor, being as you've looked so closely into this would you be interested in doing a PR?

    I have some stuff I'm working on at work right and I'm going to be out of town Thursday Through Sunday so I won't be able to tackle this until at least next week.

  2. divfor commented on May 12, 2015

    @divfor
    ContributorAuthor

    submitted in PR #394

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions