Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions appium/webdriver/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,18 @@ def find_element_by_ios_class_chain(self, class_chain_string):
- class_chain_string - The class chain string

:Usage:
driver.find_element_by_class_chain('XCUIElementTypeWindow/XCUIElementTypeButton[3]')
driver.find_element_by_ios_class_chain('XCUIElementTypeWindow/XCUIElementTypeButton[3]')
"""
return self.find_element(by=By.IOS_CLASS_CHAIN, value=class_chain_string)

def find_elements_by_class_chain(self, class_chain_string):
def find_elements_by_ios_class_chain(self, class_chain_string):
"""Finds elements by ios class chain string.

:Args:
- class_chain_string - The class chain string

:Usage:
driver.find_elements_by_class_chain('XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]')
driver.find_elements_by_ios_class_chain('XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]')
"""
return self.find_elements(by=By.IOS_CLASS_CHAIN, value=class_chain_string)

Expand Down
6 changes: 3 additions & 3 deletions appium/webdriver/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ def find_element_by_ios_class_chain(self, class_chain_string):
- class_chain_string - The class chain string

:Usage:
driver.find_element_by_class_chain('XCUIElementTypeWindow/XCUIElementTypeButton[3]')
driver.find_element_by_ios_class_chain('XCUIElementTypeWindow/XCUIElementTypeButton[3]')
"""
return self.find_element(by=By.IOS_CLASS_CHAIN, value=class_chain_string)

def find_elements_by_class_chain(self, class_chain_string):
def find_elements_by_ios_class_chain(self, class_chain_string):
"""Finds elements by ios class chain string.

:Args:
- class_chain_string - The class chain string

:Usage:
driver.find_elements_by_class_chain('XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]')
driver.find_elements_by_ios_class_chain('XCUIElementTypeWindow[2]/XCUIElementTypeAny[-2]')
"""
return self.find_elements(by=By.IOS_CLASS_CHAIN, value=class_chain_string)

Expand Down
4 changes: 2 additions & 2 deletions test/functional/ios/desired_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

def get_desired_capabilities(app):
desired_caps = {
'deviceName': 'iPhone 5s',
'deviceName': 'iPhone 6s',
'platformName': 'iOS',
'platformVersion': '10.2',
'platformVersion': '10.3',
'app': PATH('../../apps/' + app),
'automationName': 'XCUITest',
'allowTouchIdEnroll': True
Expand Down
42 changes: 42 additions & 0 deletions test/functional/ios/find_by_ios_class_chain_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

from appium import webdriver
import desired_capabilities

class FindByIOClassChainTests(unittest.TestCase):
@classmethod
def setUpClass(self):
desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

@classmethod
def tearDownClass(self):
self.driver.quit()

def test_find_element_by_path(self):
el = self.driver.find_element_by_ios_class_chain('XCUIElementTypeWindow/*/*/XCUIElementTypeStaticText')
self.assertEqual('UICatalog', el.get_attribute('name'))

def test_find_multiple_elements_by_path(self):
el = self.driver.find_elements_by_ios_class_chain('XCUIElementTypeWindow/*/*')
self.assertEqual(len(el), 2)
self.assertEqual('UICatalog', el[0].get_attribute('name'))
self.assertEqual(None, el[1].get_attribute('name'))

if __name__ == "__main__":
suite = unittest.TestLoader().loadTestsFromTestCase(FindByIOClassChainTests)
unittest.TextTestRunner(verbosity=2).run(suite)