Reputation: 3
Th screen of my app contains two scrollable elements. I am not able to select which particular page to scroll to.
I have tried this:
Logic 1:
MobileElement element = driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().resourceId(“com.marrow:id/tvIndexTitle”)).getChildByText(”+ “new UiSelector().className(“android.widget.TextView”), “ADVANCED ORTHOPAEDICS & MANAGEMENT”)”));
Logic 2:
MobileElement element = driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().resourceId(“com.marrow:id/tvIndexTitle”)).scrollIntoView(” + “new UiSelector().text(“ADVANCED ORTHOPAEDICS & MANAGEMENT”))”));
I am not able to perform any scroll operation. Please help me regarding this.
Upvotes: 0
Views: 403
Reputation: 3658
In both cases you specified the same id of scrollable view:
new UiSelector().resourceId(“com.marrow:id/tvIndexTitle”)
It explains why you are scrolling within the same boundaries
Suggestions:
tvIndexTitle
or try with index: new UiSelector().scrollable(true).instance(1)
new UiSelector().text(...)
, use textContains
or textStartsWith
Example:
MobileElement element = driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(UiSelector().scrollable(true).instance(1)).scrollIntoView(new UiSelector().textContains(\"ADVANCED ORTHOPAEDICS\"))";
Upvotes: 1