Issue
I am new to Espresso and Mobile Testing, and I am facing a challenge. I have to search for a contact in App and click on contact displayed at second position.
I checked many posts which were similar but however none of those worked for my example.
Code to Search : onView(withId(R.id.textSearch)).perform(typeText("pa"));
Code to Select : onView(withText("Parth Vyas")).perform(click());
But here if I want to select any element which is displayed at position 2, how can I do that?
Solution
If you know the position after search, then you can try something like:
onData(anything()).inAdapterView(YOUR_ADAPTER_VIEW_MATCHER).atPosition(2).perform(click());
Answered By - Aaron
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.