Skip to content

add tag view for android #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 9, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -20,5 +20,6 @@ class MobileBy(By):
IOS_UIAUTOMATION = '-ios uiautomation'
IOS_CLASS_CHAIN = '-ios class chain'
ANDROID_UIAUTOMATOR = '-android uiautomator'
ANDROID_VIEWTAG = '-android viewtag'
ACCESSIBILITY_ID = 'accessibility id'
IMAGE = '-image'
24 changes: 24 additions & 0 deletions appium/webdriver/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,30 @@ def find_elements_by_android_uiautomator(self, uia_string):
"""
return self.find_elements(by=By.ANDROID_UIAUTOMATOR, value=uia_string)

def find_element_by_android_viewtag(self, tag):
"""Finds element by tag in Android.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, it worth to mentions that such locator only works for Espresso driver

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Yeah, I'm appending find_element_by_android_viewtag section in README. I'll mention the point here as well.

https://developer.android.com/reference/android/view/View

:Args:
- tag - The tag name of the view to look for

:Usage:
driver.find_element_by_android_viewtag('a tag name')
"""
return self.find_element(by=By.ANDROID_VIEWTAG, value=tag)

def find_elements_by_android_viewtag(self, tag):
"""Finds element by tag in Android.
https://developer.android.com/reference/android/view/View

:Args:
- tag - The tag name of the view to look for

:Usage:
driver.find_elements_by_android_viewtag('a tag name')
"""
return self.find_elements(by=By.ANDROID_VIEWTAG, value=tag)

def find_element_by_image(self, png_img_path,
match_threshold=DEFAULT_MATCH_THRESHOLD):
"""Finds a portion of a screenshot by an image.
Expand Down