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

Python RemoteDriver regression in version 3.14.0 #6250

Closed
jugglinmike opened this issue Aug 4, 2018 · 5 comments
Closed

Python RemoteDriver regression in version 3.14.0 #6250

jugglinmike opened this issue Aug 4, 2018 · 5 comments
Labels

Comments

@jugglinmike
Copy link
Contributor

OS: macOS
Selenium Version: 3.14.0 (Python bindings)
Browser: Apple Safari
Browser Version: 11.1.1 (13605.2.8)

Expected Behavior -

The RemoteDriver should be capable of sending multiple commands to the same session.

Actual Behavior -

The RemoteDriver fails to interact with a session following creation.

Steps to reproduce -

Given a file repro.py:

from selenium import webdriver
driver = webdriver.Remote('http://127.0.0.1:4444')
driver.title

And a running instance of safaridriver via

$ safaridriver --port 4444

Version 3.13.0 executes the script with no errors. Version 3.14.0 reports the following error:

Traceback (most recent call last):
  File "repro.py", line 3, in <module>
    driver.title
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 341, in title
    resp = self.execute(Command.GET_TITLE)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 208, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: 

(The reported error message is truncated.)

jugglinmike added a commit to bocoup/wpt that referenced this issue Aug 4, 2018
This reverts commit c157912.

Version 3.14.0, released on 2018-08-02, includes a bug which regresses
support for the "RemoteDriver" [1]. That interface is used in this
project for integration with Apple Safari. The package upgrade was fully
automated and not motivated by any specific bug fix or feature. Revert
the upgrade to restore functionality.

[1] SeleniumHQ/selenium#6250
@lmtierney
Copy link
Member

It looks like safaridriver needs keep_alive set with the urllib3 changes (using webdriver.Safari() sets keep_alive to True by default). This works without error:

from selenium import webdriver
driver = webdriver.Remote('http://127.0.0.1:4444', keep_alive=True)
driver.title

I'm not sure what change with the move to urllib3 would have caused this to start happening though. @AutomatedTester thoughts?

@lmtierney
Copy link
Member

It seems to work if I duplicate the conditional:

if body and method != 'POST' and method != 'PUT':
    body = None

To the non-keep_alive request

if self.keep_alive:
if body and method != 'POST' and method != 'PUT':
body = None
resp = self._conn.request(method, url, body=body, headers=headers)
statuscode = resp.status
else:
http = urllib3.PoolManager()
resp = http.request(method, url, body=body, headers=headers)
statuscode = resp.status
if not hasattr(resp, 'getheader'):
if hasattr(resp.headers, 'getheader'):
resp.getheader = lambda x: resp.headers.getheader(x)
elif hasattr(resp.headers, 'get'):
resp.getheader = lambda x: resp.headers.get(x)

@lmtierney
Copy link
Member

Also of note... Tech Preview returns a w3c payload so you'll get different results if you use regular safaridriver vs TP

foolip pushed a commit to web-platform-tests/wpt that referenced this issue Aug 4, 2018
This reverts commit c157912.

Version 3.14.0, released on 2018-08-02, includes a bug which regresses
support for the "RemoteDriver" [1]. That interface is used in this
project for integration with Apple Safari. The package upgrade was fully
automated and not motivated by any specific bug fix or feature. Revert
the upgrade to restore functionality.

[1] SeleniumHQ/selenium#6250
@jugglinmike
Copy link
Contributor Author

I first experienced the regression using Safari Technology Preview, but I figured the report would seem more legitimate if it were demonstrated with more stable software :)

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 8, 2018
….14.0", a=testonly

Automatic update from web-platform-testsRevert "Update selenium from 3.13.0 to 3.14.0" (#12307)

This reverts commit c1579120e855828706e6a0c613be7c5def14d7f8.

Version 3.14.0, released on 2018-08-02, includes a bug which regresses
support for the "RemoteDriver" [1]. That interface is used in this
project for integration with Apple Safari. The package upgrade was fully
automated and not motivated by any specific bug fix or feature. Revert
the upgrade to restore functionality.

[1] SeleniumHQ/selenium#6250
--

wpt-commits: 399997d1f10a529300cc20b5860e6db724b2b48f
wpt-pr: 12307
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this issue Aug 8, 2018
….14.0", a=testonly

Automatic update from web-platform-testsRevert "Update selenium from 3.13.0 to 3.14.0" (#12307)

This reverts commit c1579120e855828706e6a0c613be7c5def14d7f8.

Version 3.14.0, released on 2018-08-02, includes a bug which regresses
support for the "RemoteDriver" [1]. That interface is used in this
project for integration with Apple Safari. The package upgrade was fully
automated and not motivated by any specific bug fix or feature. Revert
the upgrade to restore functionality.

[1] SeleniumHQ/selenium#6250
--

wpt-commits: 399997d1f10a529300cc20b5860e6db724b2b48f
wpt-pr: 12307
@barancev barancev added the C-py label Aug 9, 2018
@jugglinmike
Copy link
Contributor Author

Thanks, @AutomatedTester!

grigaman pushed a commit to grigaman/selenium that referenced this issue Sep 20, 2018
 SeleniumHQ#6250

Some servers seem to read the body of GET requests and then crash, this
change helps them not crash but in reality they need to be doing their
own defensive code.
@lock lock bot locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants