Skip to content

Commit b6c3503

Browse files
committed
Add new locator strategy find_element_by_windows_uiautomation
1 parent 45f5656 commit b6c3503

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

appium/webdriver/common/mobileby.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class MobileBy(By):
2222
ANDROID_UIAUTOMATOR = '-android uiautomator'
2323
ANDROID_VIEWTAG = '-android viewtag'
2424
ANDROID_DATA_MATCHER = '-android datamatcher'
25+
WINDOWS_UI_AUTOMATION = '-windows uiautomation'
2526
ACCESSIBILITY_ID = 'accessibility id'
2627
IMAGE = '-image'
2728
CUSTOM = '-custom'

appium/webdriver/webdriver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
159159
By.IOS_CLASS_CHAIN = MobileBy.IOS_CLASS_CHAIN
160160
By.ANDROID_UIAUTOMATOR = MobileBy.ANDROID_UIAUTOMATOR
161161
By.ANDROID_VIEWTAG = MobileBy.ANDROID_VIEWTAG
162+
By.WINDOWS_UI_AUTOMATION = MobileBy.WINDOWS_UI_AUTOMATION
162163
By.ACCESSIBILITY_ID = MobileBy.ACCESSIBILITY_ID
163164
By.IMAGE = MobileBy.IMAGE
164165
By.CUSTOM = MobileBy.CUSTOM

appium/webdriver/webelement.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ def find_elements_by_accessibility_id(self, accessibility_id):
216216
"""
217217
return self.find_elements(by=MobileBy.ACCESSIBILITY_ID, value=accessibility_id)
218218

219+
def find_element_by_windows_uiautomation(self, win_uiautomation):
220+
"""Finds an element by windows uiautomation
221+
222+
Args:
223+
win_uiautomation (str): The element name in the windows UIAutomation selector
224+
225+
Usage:
226+
driver.find_element_by_windows_uiautomation()
227+
228+
Returns:
229+
`appium.webdriver.webelement.WebElement`
230+
"""
231+
return self.find_element(by=MobileBy.WINDOWS_UI_AUTOMATION, value=win_uiautomation)
232+
219233
def find_element(self, by=By.ID, value=None):
220234
"""Find an element given a By strategy and locator
221235

0 commit comments

Comments
 (0)