'Scroll down method selects text in Appium

I'm using TouchAction with coordinates in Appium to scroll down the native app. Code sample:

TouchAction ts = new TouchAction(driver);ts.press(207, 582).moveTo(8, -360).release().perform();

But there is a caveat - one section in the app contains a large piece of text. And instead of scrolling down the methods selects the words in the text (like a long press to copy the word) and doesn't scroll. I've tried setting coordinates to avoid the text during scrolling but no avail.



Solution 1:[1]

import io.appium.java_client.TouchAction;

TouchAction action = new TouchAction(driver);
        action.press(PointOption.point(startX,startY))
              .waitAction(WaitOptions.waitOptions(Duration.ofMillis(500)))
              .moveTo(PointOption.point(endX, endY))  
              .release().perform();

If you are automating iOS, check out this,

JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", "down");
js.executeScript("mobile: scroll", scrollObject);

For more details - here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Azhagusundaram Tamil