簡體   English   中英

向下滾動方法選擇 Appium 中的文本

[英]Scroll down method selects text in Appium

我在 Appium 中使用帶有坐標的 TouchAction 向下滾動本機應用程序。 代碼示例:

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

但有一個警告 - 應用程序中的一個部分包含一大段文本。 方法不是向下滾動,而是選擇文本中的單詞(如長按復制單詞)並且不滾動。 我嘗試設置坐標以避免滾動期間出現文本,但無濟於事。 你遇到過這個問題嗎? 任何幫助,將不勝感激。 如果可能,請包含代碼示例! 謝謝!

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();

如果您正在自動化 iOS,請查看此內容,

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

欲了解更多詳情 - 在這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM