Skip to content

Commit 5296b5b

Browse files
mxschmittAutomatedTester
authored andcommitted
fix: DeprecationWarning of base64.encodestring() (#7446)
[py] DeprecationWarning of base64.encodestring()
1 parent f36d8f4 commit 5296b5b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

py/selenium/webdriver/remote/webelement.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
except NameError:
3434
pass
3535

36+
try:
37+
from base64 import encodebytes
38+
except ImportError: # 3+
39+
from base64 import encodestring as encodebytes
40+
3641
try:
3742
from StringIO import StringIO as IOStream
3843
except ImportError: # 3+
@@ -735,7 +740,7 @@ def _upload(self, filename):
735740
zipped = zipfile.ZipFile(fp, 'w', zipfile.ZIP_DEFLATED)
736741
zipped.write(filename, os.path.split(filename)[1])
737742
zipped.close()
738-
content = base64.encodestring(fp.getvalue())
743+
content = encodebytes(fp.getvalue())
739744
if not isinstance(content, str):
740745
content = content.decode('utf-8')
741746
try:

0 commit comments

Comments
 (0)