Python Selenium client 3.3.0 doesn't support Python 3 any more
The Python Selenium client verson 3.3 at PyPI, which was uploaded today, doesn't work on Python 3 any more. Version 3.0.2 works fine.
It now produces errors like this:
env/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py:92: in __init__
self.start_session(desired_capabilities, browser_profile)
env/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py:179: in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
env/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py:236: in execute
response = self.command_executor.execute(driver_command, params)
env/lib/python3.4/site-packages/selenium/webdriver/remote/remote_connection.py:415: in execute
return self._request(command_info[0], url, body=data)
env/lib/python3.4/site-packages/selenium/webdriver/remote/remote_connection.py:479: in _request
base64string = base64.b64encode('%s:%s' % (parsed_url.username, parsed_url.password))
env/lib/python3.4/base64.py:62: in b64encode
encoded = binascii.b2a_base64(s)[:-1]
E TypeError: 'str' does not support the buffer interface
If you can't reproduce this, let me know and I'll figure out exactly what's in my desired_capabilities dict.
I have tried to recreate this issue and I can't. Since there is no actionable steps to reproduce this issue so closing.
dburns in ~/development/selenium/py on master λ tox -r -e py36-marionette -- -k=cookie_test
GLOB sdist-make: /Users/dburns/development/selenium/py/setup.py
py36-marionette recreate: /Users/dburns/development/selenium/py/.tox/py36-marionette
py36-marionette installdeps: pytest==3.0.3, pytest-instafail==0.3.0, pytest-xdist==1.15
py36-marionette inst: /Users/dburns/development/selenium/py/.tox/dist/selenium-3.3.0.zip
py36-marionette installed: apipkg==1.4,appdirs==1.4.3,execnet==1.4.1,packaging==16.8,py==1.4.32,pyparsing==2.2.0,pytest==3.0.3,pytest-instafail==0.3.0,pytest-xdist==1.15.0,selenium==3.3.0,six==1.10.0
py36-marionette runtests: PYTHONHASHSEED='2189515118'
py36-marionette runtests: commands[0] | py.test -n=auto --driver=Marionette -k=cookie_test
================================================================================== test session starts ===================================================================================
platform darwin -- Python 3.6.0, pytest-3.0.3, py-1.4.32, pluggy-0.4.0
rootdir: /Users/dburns/development/selenium/py, inifile: setup.cfg
plugins: xdist-1.15.0, instafail-0.3.0
gw0 [7] / gw1 [7] / gw2 [7] / gw3 [7]
scheduling tests via LoadScheduling
.......
=============================================================================== 7 passed in 53.81 seconds ================================================================================
________________________________________________________________________________________ summary _________________________________________________________________________________________
py36-marionette: commands succeeded
congratulations :)
dburns in ~/development/selenium/py on master λ
I suspect this is a regression from https://github.com/SeleniumHQ/selenium/commit/dc5a865fcd09d089d24898b1ecc2fb7705026a48.. /cc @llaskin
This is my desired_capabilities dict:
{
'maxDuration': 7200,
'tags': ['prod-build'],
'tunnel-identifier': '5949.1',
'recordVideo': True,
'recordLogs': True,
'captureHtml': True,
'build': '5949',
'videoUploadOnPass': False,
'webdriverRemoteQuietExceptions': False,
'browserName': 'chrome',
'platform': 'Windows 7',
'screenResolution': '1280x1024',
'customData': {
'branch': 'prod-build',
'travis': 'https://magnum.travis-ci.com/Tutorfair/TutorfairWebsite/builds/41462182',
'commit': '4952424',
'pull request': 'false'
},
'recordScreenshots': True
}
@AutomatedTester is there anything else you need to know to reproduce?
I am also getting this issue as soon as we upgraded to 3.3.0 all of our python tests fail:
Traceback (most recent call last):
File "/home/travis/build/open-learning-exchange/BeLL-Apps/tests/base_case.py", line 49, in setUp
command_executor=sauce_url % (USERNAME, ACCESS_KEY))
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
response = self.command_executor.execute(driver_command, params)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 415, in execute
return self._request(command_info[0], url, body=data)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 479, in _request
base64string = base64.b64encode('%s:%s' % (parsed_url.username, parsed_url.password))
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/base64.py", line 59, in b64encode
encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'str'
What kind of information do you need?
@AutomatedTester I notice @jadatkins is using Python 3.4 and I am using python 3.5.2, but if I understand correctly you tested with Python 3.6. Do you think that would make any difference?
This looks like it is related to Saucelabs. Since Saucelabs submitted the code, perhaps @titusfortner or @llaskin can look and fix this.
This wasn't related to Sauce Labs, it's just that b64decode expects a bytes-like object in Python 3. I've added a failing unit test for this, and a subsequent fix. Let's encourage all future Python client contributions to include test coverage.