简体   繁体   中英

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. Have you faced this issue? Any help would be appreciated. Please include code samples if possible! thanks!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM