Skip to content

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()

}
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.

4 participants