File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,22 @@ els = self.driver.find_elements_by_android_uiautomator('new UiSelector().clickab
159159self.assertIsInstance(els, list)
160160```
161161
162+ ### Finding elements by Android viewtag search
163+
164+ This method allows finiding elements using [View#tags](https://developer.android.com/reference/android/view/View#tags).
165+ This method works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
166+
167+ Adds the methods `driver.find_element_by_android_viewtag` and `driver.find_elements_by_android_viewtag`.
168+
169+ ```python
170+ el = self.driver.find_element_by_android_viewtag(' a tag name' )
171+ self.assertIsNotNone(el)
172+ ```
173+
174+ ```python
175+ els = self.driver.find_elements_by_android_viewtag(' a tag name' )
176+ self.assertIsInstance(els, list)
177+ ```
162178
163179### Finding elements by iOS predicates
164180
Original file line number Diff line number Diff line change @@ -20,5 +20,6 @@ class MobileBy(By):
2020 IOS_UIAUTOMATION = '-ios uiautomation'
2121 IOS_CLASS_CHAIN = '-ios class chain'
2222 ANDROID_UIAUTOMATOR = '-android uiautomator'
23+ ANDROID_VIEWTAG = '-android viewtag'
2324 ACCESSIBILITY_ID = 'accessibility id'
2425 IMAGE = '-image'
Original file line number Diff line number Diff line change @@ -341,6 +341,30 @@ def find_elements_by_android_uiautomator(self, uia_string):
341341 """
342342 return self .find_elements (by = By .ANDROID_UIAUTOMATOR , value = uia_string )
343343
344+ def find_element_by_android_viewtag (self , tag ):
345+ """Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
346+ It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
347+
348+ :Args:
349+ - tag - The tag name of the view to look for
350+
351+ :Usage:
352+ driver.find_element_by_android_viewtag('a tag name')
353+ """
354+ return self .find_element (by = By .ANDROID_VIEWTAG , value = tag )
355+
356+ def find_elements_by_android_viewtag (self , tag ):
357+ """Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
358+ It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
359+
360+ :Args:
361+ - tag - The tag name of the view to look for
362+
363+ :Usage:
364+ driver.find_elements_by_android_viewtag('a tag name')
365+ """
366+ return self .find_elements (by = By .ANDROID_VIEWTAG , value = tag )
367+
344368 def find_element_by_image (self , png_img_path ,
345369 match_threshold = DEFAULT_MATCH_THRESHOLD ):
346370 """Finds a portion of a screenshot by an image.
You can’t perform that action at this time.
0 commit comments