【发布时间】:2018-06-21 11:14:44
【问题描述】:
我正在对我的 Android 应用进行自动化测试,并且需要滚动才能看到需要滚动的字段。
我尝试使用来自here的以下代码:
TouchActions action = new TouchActions(driver);
action.scroll(element, 10, 100);
action.perform();
运行此代码后,它给了我这个错误:
java.lang.ClassCastException:
io.appium.java_client.android.AndroidDriver cannot be cast to
org.openqa.selenium.interactions.HasTouchScreen
嗯,我知道我已经通过了TouchActions 中的驱动程序,它的类型是AndroidDriver。
我该如何解决这个问题?
【问题讨论】:
-
你到底想要什么?滚动或滚动到任何特定元素?
-
现在,我需要滚动。谢谢
-
好吧,它在您定义 TouchAction(); 的函数的最后一行给了我一个错误; “新的 TouchAction(driver).press(anchor, startPoint).waitAction(Duration.ofMillis(duration)).moveTo(anchor, endPoint).release().perform();”那就是“构造函数TouchAction(AppiumDriver)未定义”你能帮我解决这个错误吗?
标签: appium-android