Scroll the screen to bottom without scrollview and without ID and without firstChild android-espresso automation -
Scroll the screen to bottom without scrollview and without ID and without firstChild android-espresso automation -
i want scroll bottom of current screen displayed, but
application don't have scrollview. application have horizontalscrollview out of context. using onview, tablelayout id in screen. throws error matches multiple views in hierarchy. using onview, getting firstchild() still throws error cannot perform operation, error performing 'scroll to' on view 'with first kid view of type parentmatcher'. tried ondata(hastostring(startswith(). throws error matches multiple views in hierarchy. tried other ways getting current monitor , activity still didn't work.
ok, can suggest, based on scanty info in question:
easy approach (but not correct) - swipe int gridview go bottom:
onview(withid(r.id.gridview_id)).perform(swipeup());
easy approach:
ondata(instanceof(object_in_the_row.class)) .inadapterview(withid(r.id.gridview_id)) .atposition(2) //position # can if have header or not .check(matches(isdisplayed())) .perform(click()); //or other action, or no action
approach prefer:
ondata(withrowtext("unique_text_in_row3")) .inadapterview(withid(r.id.gridview_id)) .check(matches(isdisplayed())) .perform(click());
where withrowtext() custom matcher match specific text in row3, like:
public static matcher<object> withrowtext(string expectedtext) { checks.checknotnull(expectedtext); homecoming withrowtext(equalto(expectedtext)); } public static matcher<object> withrowtext(final matcher<string> itemtextmatcher) { checks.checknotnull(itemtextmatcher); homecoming new boundedmatcher<object, rowobject>(rowobject.class) { @override public boolean matchessafely(rowobject rowobject) { homecoming itemtextmatcher.matches(rowobject.text); } @override public void describeto(description description) { description.appendtext("with rowobject: "); itemtextmatcher.describeto(description); } }; }
btw, "gridview viewgroup displays items in two-dimensional, scrollable grid."
android-espresso
Comments
Post a Comment