Skip to content

Commit 0add6f6

Browse files
authored
bump selenium 3.14.1, call RemoteCommand without workaround (#259)
* bump selenium 3.14.1, call RemoteCommand without workaround * make attributeValue check safe * define str = basestring for Python 2 * apply formatter * add missing value check
1 parent 53dedda commit 0add6f6

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

appium/webdriver/webelement.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,57 @@
2020

2121
from .mobilecommand import MobileCommand as Command
2222

23+
# Python 3 imports
24+
try:
25+
str = basestring
26+
except NameError:
27+
pass
28+
2329

2430
class WebElement(SeleniumWebElement):
31+
# Override
32+
def get_attribute(self, name):
33+
"""Gets the given attribute or property of the element.
34+
35+
This method will first try to return the value of a property with the
36+
given name. If a property with that name doesn't exist, it returns the
37+
value of the attribute with the same name. If there's no attribute with
38+
that name, ``None`` is returned.
39+
40+
Values which are considered truthy, that is equals "true" or "false",
41+
are returned as booleans. All other non-``None`` values are returned
42+
as strings. For attributes or properties which do not exist, ``None``
43+
is returned.
44+
45+
:Args:
46+
- name - Name of the attribute/property to retrieve.
47+
48+
Example::
49+
50+
# Check if the "active" CSS class is applied to an element.
51+
is_active = "active" in target_element.get_attribute("class")
52+
53+
"""
54+
55+
resp = self._execute(RemoteCommand.GET_ELEMENT_ATTRIBUTE, {'name': name})
56+
attributeValue = resp.get('value')
57+
58+
if attributeValue is None:
59+
return None
60+
61+
if not isinstance(attributeValue, str):
62+
attributeValue = unicode(attributeValue)
63+
64+
if name != 'value' and attributeValue.lower() in ('true', 'false'):
65+
return attributeValue.lower()
66+
67+
return attributeValue
68+
69+
# Override
70+
def is_displayed(self):
71+
"""Whether the element is visible to a user."""
72+
return self._execute(RemoteCommand.IS_ELEMENT_DISPLAYED)['value']
73+
2574
def find_element_by_ios_uiautomation(self, uia_string):
2675
"""Finds an element by uiautomation in iOS.
2776

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@
5050
'Topic :: Software Development :: Quality Assurance',
5151
'Topic :: Software Development :: Testing'
5252
],
53-
install_requires=['selenium>=2.47.0']
53+
install_requires=['selenium>=3.14.1']
5454
)

test/functional/ios/desired_capabilities.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_desired_capabilities(app):
2828
desired_caps = {
2929
'deviceName': iphone_device_name(),
3030
'platformName': 'iOS',
31-
'platformVersion': '10.3',
31+
'platformVersion': '11.4',
3232
'app': PATH('../../apps/' + app),
3333
'automationName': 'XCUITest',
3434
'allowTouchIdEnroll': True,
@@ -66,8 +66,8 @@ def wda_port():
6666

6767
def iphone_device_name():
6868
if PytestXdistWorker.NUMBER == PytestXdistWorker.gw(0):
69-
return 'iPhone 6s - 8100'
69+
return 'iPhone 8 - 8100'
7070
elif PytestXdistWorker.NUMBER == PytestXdistWorker.gw(1):
71-
return 'iPhone 6s - 8101'
71+
return 'iPhone 8 - 8101'
7272

73-
return 'iPhone 6s'
73+
return 'iPhone 8'

0 commit comments

Comments
 (0)