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
1 change: 1 addition & 0 deletions appium/webdriver/common/mobileby.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
class MobileBy(By):
IOS_PREDICATE = '-ios predicate string'
IOS_UIAUTOMATION = '-ios uiautomation'
IOS_CLASS_CHAIN = '-ios class chain'
ANDROID_UIAUTOMATOR = '-android uiautomator'
ACCESSIBILITY_ID = 'accessibility id'
23 changes: 23 additions & 0 deletions appium/webdriver/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
# add new method to the `find_by_*` pantheon
By.IOS_UIAUTOMATION = MobileBy.IOS_UIAUTOMATION
By.IOS_PREDICATE = MobileBy.IOS_PREDICATE
By.IOS_CLASS_CHAIN = MobileBy.IOS_CLASS_CHAIN
By.ANDROID_UIAUTOMATOR = MobileBy.ANDROID_UIAUTOMATOR
By.ACCESSIBILITY_ID = MobileBy.ACCESSIBILITY_ID

Expand Down Expand Up @@ -121,6 +122,28 @@ def find_elements_by_ios_predicate(self, predicate_string):
"""
return self.find_elements(by=By.IOS_PREDICATE, value=predicate_string)

def find_element_by_ios_class_chain(self, class_chain_string):
"""Find an element by ios class chain string.
:Args:
- class_chain_string - The class chain string
:Usage:
driver.find_element_by_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):
"""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]')
"""
return self.find_elements(by=By.IOS_CLASS_CHAIN, value=class_chain_string)

def find_element_by_android_uiautomator(self, uia_string):
"""Finds element by uiautomator in Android.
Expand Down
22 changes: 22 additions & 0 deletions appium/webdriver/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@ def find_elements_by_ios_predicate(self, predicate_string):
"""
return self.find_elements(by=By.IOS_PREDICATE, value=predicate_string)

def find_element_by_ios_class_chain(self, class_chain_string):
"""Find an element by ios class chain string.

:Args:
- class_chain_string - The class chain string

:Usage:
driver.find_element_by_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):
"""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]')
"""
return self.find_elements(by=By.IOS_CLASS_CHAIN, value=class_chain_string)

def find_element_by_android_uiautomator(self, uia_string):
"""Finds element by uiautomator in Android.

Expand Down