I7210I
1
Hello,
I want to scroll Horizontal on element, till element with specific text so I did:
getDriver().findElement(MobileBy.AndroidUIAutomator(""new UiScrollable(new UiSelector().scrollable(true).instance(0)).setAsHorizontalList().scrollIntoView(new UiSelector().text(\""+textToSearch+"\"))")).click();
and still the element is not founded and not clicked of course…what to do?
thank you
Maybe you trying scroll wrong view…
How many scroll views you have on screen?
I7210I
3
One that is Horizontal and other one is vertical
In your code you selecting some first whatever on page. Try add it id to select 100% needed.
I7210I
7
ID of the element itself or the ID of the scrollable element?
Thanks
I7210I
8
if it’s on the scrollable element it didn’t work neither :
getDriver().findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().resourceIdMatches(\"com.saverone.app:id/tab_layout\").scrollable(true)).scrollIntoView(new UiSelector().text(\""+textToSearch+"\"))")).click();
Try add setAsHorizontalList
I7210I
11
Found it, the text was not written correct
I7210I
12
@Aleksei, is there any way to make the scroll slower? because when I run the code, the scroll is going too fast and it missed the text,
Thank you
with
NO. This is pure Android command → UiScrollable | Android Developers
Appium just sending it.
o! try add setSwipeDeadZonePercentage
and reduce with it scroll area
I7210I
14
How it suppose to look with that “setSwipeDeadZonePercentage”?
public void scrollToFirstHorizontalScrollableElement(String textToSearch) {
getDriver().findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true)).setAsHorizontalList().scrollIntoView(new UiSelector().text(\""+textToSearch+"\"))")).click();
}
After .setAsHorizontalList().setSwipeDeadZonePercentage(0.2)
Not sure for 0.2. Try different 0.3, 0.5
I7210I
16
I tried 0.3 and didn’t succeed 
It should scroll less. Try other values. 0.5, 10, 50