Skip to content

Commit fdf8975

Browse files
Clean up python imports in webelement
1 parent 07c7ec1 commit fdf8975

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

py/selenium/webdriver/remote/webelement.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
import base64
1819
import hashlib
1920
import pkgutil
2021
import os
2122
import zipfile
22-
try:
23-
from StringIO import StringIO as IOStream
24-
except ImportError: # 3+
25-
from io import BytesIO as IOStream
26-
import base64
2723

2824
from .command import Command
2925
from selenium.common.exceptions import WebDriverException
3026
from selenium.webdriver.common.by import By
3127
from selenium.webdriver.common.utils import keys_to_typing
3228

33-
29+
# Python 3 imports
3430
try:
3531
str = basestring
3632
except NameError:
3733
pass
3834

35+
try:
36+
from StringIO import StringIO as IOStream
37+
except ImportError: # 3+
38+
from io import BytesIO as IOStream
39+
3940

4041
class WebElement(object):
4142
"""Represents a DOM element.
@@ -129,7 +130,7 @@ def get_attribute(self, name):
129130
"""
130131

131132
attributeValue = ''
132-
if self._w3c :
133+
if self._w3c:
133134
raw = pkgutil.get_data(__package__, 'getAttribute.js')
134135
attributeValue = self.parent.execute_script(
135136
"return (%s).apply(null, arguments);" % raw,

0 commit comments

Comments
 (0)