Skip to content

Commit ee4ad67

Browse files
committed
Fix recent python 3 regressions
1 parent 69c55bb commit ee4ad67

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

py/selenium/webdriver/firefox/webdriver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ def __init__(self, firefox_profile=None, firefox_binary=None,
118118
# firefox_binary and firefox_profile
119119
# override firefox_options
120120
if firefox_binary is not None:
121-
if isinstance(firefox_binary, types.StringTypes):
121+
if isinstance(firefox_binary, basestring):
122122
firefox_binary = FirefoxBinary(firefox_binary)
123123
self.binary = firefox_binary
124124
firefox_options.binary = firefox_binary
125125
if firefox_profile is not None:
126-
if isinstance(firefox_profile, types.StringTypes):
126+
if isinstance(firefox_profile, basestring):
127127
firefox_profile = FirefoxProfile(firefox_profile)
128128
self.profile = firefox_profile
129129
firefox_options.profile = firefox_profile

py/test/selenium/webdriver/firefox/ff_profile_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_that_prefs_are_written_in_the_correct_format(self):
5959
assert 'hi there' == profile.default_preferences["sample.preference"]
6060

6161
encoded = profile.encoded
62-
decoded = base64.decodestring(encoded)
62+
decoded = base64.b64decode(encoded)
6363
with BytesIO(decoded) as fp:
6464
zip = zipfile.ZipFile(fp, "r")
6565
for entry in zip.namelist():
@@ -79,7 +79,7 @@ def test_that_unicode_prefs_are_written_in_the_correct_format(self):
7979
assert 'hi there' == profile.default_preferences["sample.preference.2"]
8080

8181
encoded = profile.encoded
82-
decoded = base64.decodestring(encoded)
82+
decoded = base64.b64decode(encoded)
8383
with BytesIO(decoded) as fp:
8484
zip = zipfile.ZipFile(fp, "r")
8585
for entry in zip.namelist():

py/test/selenium/webdriver/marionette/mn_options_tests.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
# under the License.
1717

1818
import pytest
19-
import shutil
20-
import tempfile
21-
import types
19+
20+
try:
21+
basestring
22+
except NameError: # Python 3.x
23+
basestring = str
2224

2325
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
2426
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
@@ -92,7 +94,7 @@ def test_to_capabilities(self):
9294
caps = opts.to_capabilities()
9395
assert "moz:firefoxOptions" in caps
9496
assert "profile" in caps["moz:firefoxOptions"]
95-
assert isinstance(caps["moz:firefoxOptions"]["profile"], types.StringTypes)
97+
assert isinstance(caps["moz:firefoxOptions"]["profile"], basestring)
9698
assert caps["moz:firefoxOptions"]["profile"] == profile.encoded
9799

98100
opts.add_argument("--foo")
@@ -106,5 +108,5 @@ def test_to_capabilities(self):
106108
caps = opts.to_capabilities()
107109
assert "moz:firefoxOptions" in caps
108110
assert "binary" in caps["moz:firefoxOptions"]
109-
assert isinstance(caps["moz:firefoxOptions"]["binary"], types.StringTypes)
111+
assert isinstance(caps["moz:firefoxOptions"]["binary"], basestring)
110112
assert caps["moz:firefoxOptions"]["binary"] == binary._start_cmd

0 commit comments

Comments
 (0)