Skip to content

Commit

Permalink
some more py3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeis committed Dec 9, 2013
1 parent 6999ca2 commit fac5e0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions py/selenium/webdriver/common/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class ProxyType:

@classmethod
def load(cls, value):
if isinstance(value, dict) and value.has_key('string'):
if isinstance(value, dict) and 'string' in value:
value = value['string']
value = str(value).upper()
for attr in dir(cls):
attr_value = getattr(cls, attr)
if isinstance(attr_value, dict) and attr_value.has_key('string') and \
if isinstance(attr_value, dict) and 'string' in attr_value and \
attr_value['string'] is not None and attr_value['string'] == value:
return attr_value
raise Exception("No proxy type is found for %s" % (value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
import unittest
from selenium.webdriver.remote.webelement import WebElement

try:
str = unicode
except ImportError:
pass


class ExecutingJavaScriptTests(unittest.TestCase):

Expand All @@ -26,7 +31,7 @@ def testShouldBeAbleToExecuteSimpleJavascriptAndReturnAString(self):

result = self.driver.execute_script("return document.title")

self.assertTrue(type(result) == unicode,
self.assertTrue(type(result) == str,
"The type of the result is %s" % type(result))
self.assertEqual("XHTML Test Page", result)

Expand Down

0 comments on commit fac5e0b

Please sign in to comment.