-
Notifications
You must be signed in to change notification settings - Fork 569
bump selenium 3.14.1, call RemoteCommand without workaround #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bump selenium 3.14.1, call RemoteCommand without workaround #259
Conversation
appium/webdriver/webelement.py
Outdated
resp = self._execute(RemoteCommand.GET_ELEMENT_ATTRIBUTE, {'name': name}) | ||
attributeValue = resp.get('value') | ||
if attributeValue is not None: | ||
if name != 'value' and attributeValue.lower() in ('true', 'false'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this call is not very safe if the returned value is not a string
appium/webdriver/webelement.py
Outdated
attributeValue = '' | ||
resp = self._execute(RemoteCommand.GET_ELEMENT_ATTRIBUTE, {'name': name}) | ||
attributeValue = resp.get('value') | ||
if attributeValue is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather do if attributeValue is None return None
appium/webdriver/webelement.py
Outdated
|
||
""" | ||
|
||
attributeValue = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resp = self._execute(RemoteCommand.GET_ELEMENT_ATTRIBUTE, {'name': name})
attributeValue = resp.get('value')
if attributeValue is None:
return None
# The standard requires attribute values to be of type String or None
if not isinstance(attributeValue, basestring):
attributeValue = unicode(attributeValue)
if name != 'value' and attributeValue.lower() in ('true', 'false'):
return attributeValue.lower()
return attributeValue
if attributeValue is None: | ||
return None | ||
|
||
if not isinstance(attributeValue, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basestring
and unicode
don't work in Python3. str
is probably enough in this case. (This work both 2 and 3.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this coercion will throw an error in python2 if the value contains unicode chars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://python-future.org/compatible_idioms.html, check basestring
and unicode
points
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah..
I see.. will fix later
@@ -20,8 +20,56 @@ | |||
|
|||
from .mobilecommand import MobileCommand as Command | |||
|
|||
# Python 3 imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, hacky
appium/webdriver/webelement.py
Outdated
if not isinstance(attributeValue, str): | ||
attributeValue = unicode(attributeValue) | ||
|
||
if attributeValue.lower() in ('true', 'false'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add name != 'value' and
closes #258
selenium 3.14.1 has workaround, calling JavaScript, for
get_attribute
andis_displayed
in W3C.In this PR, I override them in
webelement.py
to remove the workaround for AppiumI tested on my locale for each command.