gpt4 book ai didi

c# - IWebDriver 对象必须实现或包装实现 IHasTouchScreen 的驱动程序。参数名称 : driver

转载 作者:行者123 更新时间:2023-11-30 02:04:30 26 4
gpt4 key购买 nike

同时使用 c# 编写代码以使用 appium 自动化 native android 应用程序。我需要滚动到 ListView 的末尾,但是当使用触摸操作时,我面临问题“IWebDriver 对象必须实现或包装实现 IHasTouchScreen 的驱动程序。参数名称:驱动”

我的滚动代码是:

TouchActions action = new TouchActions(driver);
action.Scroll(listoffiles[0], 0, 300)

我正在使用 appium 1.4

最佳答案

驱动需要作为IPerformsTouchActions传入。

例子:

driver = AppiumDriver<AppiumWebElement>(server.ServerUri, capabilities);

public static void Swipe(IPerformsTouchActions driver, int startX, int startY, int endX, int endY, int duration)
{
ITouchAction touchAction = new TouchAction(driver)
.Press (startX, startY)
.Wait (duration)
.MoveTo (endX, endY)
.Release ();

touchAction.Perform();
}

如果将 driver 作为 IWebDriverAppiumDriver 传递给该方法,它将无法工作!

关于c# - IWebDriver 对象必须实现或包装实现 IHasTouchScreen 的驱动程序。参数名称 : driver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30909818/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com