-
-
Notifications
You must be signed in to change notification settings - Fork 77
viewtag selector strategy #189
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
Conversation
cf55c92
to
b9e3dc1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
@Nullable | ||
public String getViewTag() { | ||
Object tag = view.getTag(); | ||
if (tag != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return tag == null ? null : tag.toString()
@@ -179,6 +182,9 @@ public void describeTo(Description description) { | |||
views = getViews(root, withXPath(selector), false); | |||
} | |||
break; | |||
case VIEW_TAG: | |||
views = getViews(root, withTagValue(allOf(instanceOf(String.class), equalTo((Object) selector))), findOne); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why findOne? Cannot it be that two views have the same tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findOne
is a boolean variable... if it's false it will look for multiple instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should've be called shouldFindOne
Add custom selector that targets elements by the View Tag
(related to: appium/appium#6025)