Skip to content

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

Merged
merged 3 commits into from
Jul 31, 2018
Merged

viewtag selector strategy #189

merged 3 commits into from
Jul 31, 2018

Conversation

dpgraham
Copy link
Contributor

Add custom selector that targets elements by the View Tag

(related to: appium/appium#6025)

@dpgraham dpgraham force-pushed the dpgraham-view-selector branch from cf55c92 to b9e3dc1 Compare July 30, 2018 20:35
Copy link
Member

@jlipps jlipps left a 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) {
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants