Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent webdriver client Session.close() exception #14715

Merged

Conversation

sideshowbarker
Copy link
Contributor

@sideshowbarker sideshowbarker commented Jan 4, 2019

This change adds handling for the case when the call to self.send_session_command("DELETE", "window") in Session.close() in tools/webdriver/webdriver/client.py returns None.

Otherwise without this change, the code ends up checking len() on the return value of self.send_session_command("DELETE", "window"), which can result in a "TypeError: object of type 'NoneType' has no len()" exception.

Fixes #14714


If the code in this patch isn’t the right/best way (or the most idiomatic way in Python) to deal with the problem in #14714, then let’s use this PR branch to update the patch to fix it the right way.

This change adds handling for the case when the call to
self.send_session_command("DELETE", "window") in Session.close() in
tools/webdriver/webdriver/client.py returns None.

Otherwise without this change, the code ends up checking len() on the
return value of self.send_session_command("DELETE", "window"), which can
result in a "TypeError: object of type 'NoneType' has no len()" exception.

Fixes #14714
@andreastt andreastt merged commit e90f4c8 into master Jan 4, 2019
@sideshowbarker sideshowbarker deleted the sideshowbarker/webdriver-client-deleted-window-handles-fix branch January 4, 2019 14:17
@gsnedders
Copy link
Member

Do we still have any test for the expected return value here?

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

Successfully merging this pull request may close these issues.

TypeError: object of type 'NoneType' has no len() exception from webdriver client Session.close()
5 participants