在运行 Android API 级别 17 的真实设备上使用 appium-selendroid 模式,我尝试使用以下代码向下滚动
TouchActions action = new TouchActions(driver).scroll(0,100);
action.perform();
然而,滚动发生,元素没有被渲染。请帮助找出问题。
在运行 Android API 级别 17 的真实设备上使用 appium-selendroid 模式,我尝试使用以下代码向下滚动
TouchActions action = new TouchActions(driver).scroll(0,100);
action.perform();
然而,滚动发生,元素没有被渲染。请帮助找出问题。
解决方案——实现一个使用RemoteWebDriver接口的类 public class SwipeableWebDriver extends RemoteWebDriver implements HasTouchScreen { public RemoteTouchScreen touch;
public SwipeableWebDriver(URL url, Capabilities caps) {
super(url, caps);
touch = new RemoteTouchScreen(getExecuteMethod());
}
public TouchScreen getTouch() {
return touch;
}
现在实例化这个类的一个驱动程序,并使用问题中给出的 Touch 类,用“轻弹”手势而不是滚动。
我正在使用相同的代码并且面临相同的问题,并且在使用轻弹方法后它已为我修复。已经在这里回答了
不要使用滚动,只需将其替换为 flick,您还必须使用 flick 提供元素地址。
TouchActions action = new TouchActions(driver).flick(element_add, 0, -1000, 100); 动作.执行();