Am getting the following error:
if parsed_url.username:
base64string = base64.b64encode('{0.username}:{0.password}'.format(parsed_url).encode())
> request.add_header('Authorization', 'Basic {}'.format(base64string).decode())
E AttributeError: 'str' object has no attribute 'decode'
../../../../miniconda3/envs/ap-webqa/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py:480: AttributeError
I may be missing something, but isn't 'Basic {}'.format(base64string) going to produce a string, which doesn't have a decode method.
@davehunt this was a recent change from you. What am I missing?
(I'm running selenium 3.3.1 with pytest-selenium 1.9.1 on python 3.6)
This is fixed in master but not released yet.
@lmtierney - please see link above - it is link to line in master - I have done git blame on master. Are you sure it's fixed?
Sorry I thought this was a duplicate of an earlier issue, and the commit is actually in 3.3.1
That's what I'm saying. @davehunt's commit from 5 days ago is the source of my issue.
(just so we're clear - I have a lot of love for @davehunt - I'm going to take a stab at fixing this myself and adding a test)
Hmm... I can look into this tomorrow. Strange that my new unit test failed without my fix and passed with it. I must have missed something. If you get to it first Sarah, I'll be very grateful. ☺️
Dave Hunt
On 15 Mar 2017, at 19:37, Sarah Bird notifications@github.com wrote:
(just so we're clear - I have a lot of love for @davehunt - I'm going to take a stab at fixing this myself and adding a test)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Found why the test didn't pick it up.
The test reads:
with pytest.raises(AttributeError):
RemoteConnection('http://user:pass@remote', resolve_ip=False) \
.execute('status', {})
But the decode error is an Attribute Error
> request.add_header('Authorization', 'Basic {}'.format(base64string).decode())
E AttributeError: 'str' object has no attribute 'decode'
Aha! Yeah, I wasn't too keen on that when I wrote it. The code isn't easy to write tests around... We would either need to mock a suitable return value or be much more specific in the pytest.raises.
Dave Hunt
On 15 Mar 2017, at 21:49, Sarah Bird notifications@github.com wrote:
Found why the test didn't pick it up.
The test reads:
with pytest.raises(AttributeError): RemoteConnection('http://user:pass@remote', resolve_ip=False) \ .execute('status', {})But the decode error is an Attribute Error
request.add_header('Authorization', 'Basic {}'.format(base64string).decode())E AttributeError: 'str' object has no attribute 'decode'
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I'm hitting this bug as well. Any idea when a release is due?
I've also run up against this bug. Is there a patch/fix for it anytime soon?
+1
3.3.2 has been released: https://pypi.python.org/pypi/selenium/3.3.2
Thanks @davehunt !
Most helpful comment
3.3.2 has been released: https://pypi.python.org/pypi/selenium/3.3.2