C# IWebDriver对象必须实现或包装实现iHastuchScreen的驱动程序。参数名称:驱动程序

C# IWebDriver对象必须实现或包装实现iHastuchScreen的驱动程序。参数名称:驱动程序,c#,android,appium,C#,Android,Appium,在用c#编写代码时,使用appium实现本地android应用程序的自动化。我需要滚动到listview的末尾,但当使用touchactions时,我面临的问题是“IWebDriver对象必须实现或包装一个实现IhaTouchScreen的驱动程序。 参数名称:驱动程序“ 我的滚动代码是: TouchActions action = new TouchActions(driver); action.Scroll(listoffiles[0], 0, 300) 我使用的是

在用c#编写代码时,使用appium实现本地android应用程序的自动化。我需要滚动到listview的末尾,但当使用touchactions时,我面临的问题是“IWebDriver对象必须实现或包装一个实现IhaTouchScreen的驱动程序。 参数名称:驱动程序“

我的滚动代码是:

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=AppiumDriver(server.ServerUri,capabilities);
公共静态无效滑动(IPerFormTouchActions驱动程序、int-startX、int-startY、int-endX、int-endY、int-duration)
{
ITouchAction touchAction=新的touchAction(驱动程序)
.按(startX、startY)
.等待(持续时间)
.MoveTo(endX,endY)
.Release();
touchAction.Perform();
}

如果将
driver
作为
IWebDriver
AppiumDriver
传递到该方法中,它将不起作用

好的,谢谢你的解决方案。我会检查这一点,让你知道这是否有效。我还注意到你使用的是TouchActions类,它不适用于移动设备。移动动作通过触摸动作完成。