Skip to content

Commit

Permalink
Fix W3C check in WebElement.
Browse files Browse the repository at this point in the history
The driver was changed in cefa1bf to
look at the 'status' field, rather than 'specificationLevel', but
941ddb9 (which predates it, but was
merged later) was doing it the old way.

This also avoids changing the constructor signature.
  • Loading branch information
juangj committed Aug 12, 2016
1 parent 4326cb0 commit e87363f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def create_web_element(self, element_id):
"""
Creates a web element with the specified element_id.
"""
return WebElement(self, element_id, capabilities=self.capabilities)
return WebElement(self, element_id, w3c=self.w3c)

def _unwrap_value(self, value):
if isinstance(value, dict) and ('ELEMENT' in value or 'element-6066-11e4-a52e-4f735466cecf' in value):
Expand Down
5 changes: 2 additions & 3 deletions py/selenium/webdriver/remote/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ class WebElement(object):
'readonly', 'allowfullscreen', 'selected', 'formnovalidate',
'multiple', 'autofocus', 'open', 'loop', 'autoplay']

def __init__(self, parent, id_, capabilities):
def __init__(self, parent, id_, w3c=False):
self._parent = parent
self._id = id_
self.capabilities = capabilities
self._w3c = "specificationLevel" in self.capabilities
self._w3c = w3c

def __repr__(self):
return '<{0.__module__}.{0.__name__} (session="{1}", element="{2}")>'.format(
Expand Down

0 comments on commit e87363f

Please sign in to comment.