Appium Android 12.0 Samsung Galaxy S22 Ultra 和 Google Pixel 3 C# - System.NotImplementedException:未知的移动命令“滚动”

问题描述 投票:0回答:2

我正在尝试执行 Android 脚本,他们有适用于 Android 的滚动脚本吗?

我看到我们有 iOS 版 https://github.com/appium/appium-xcuitest-driver#platform-specific-extensions

driver.ExecuteScript("mobile: scroll", new Dictionary<string, string>() { {"direction","down" } }); 

System.NotImplementedException:未知的移动命令“滚动”。仅支持 shell、scrollBackTo、viewportScreenshot、deepLink、startLogsBroadcast、stopLogsBroadcast、acceptAlert、dismissAlert、batteryInfo、deviceInfo、changePermissions、getPermissions、performEditorAction、startScreenStreaming、stopScreenStreaming、getNotifications、listSms、type 命令。

堆栈跟踪:? RemoteWebDriver.UnpackAndThrowOnError(响应错误响应) RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 个参数) RemoteWebDriver.ExecuteScriptCommand(字符串脚本,字符串命令名称,对象[]参数) RemoteWebDriver.ExecuteScript(字符串脚本,对象[]参数)

Appium Android 12.0 三星 Galaxy S22 Ultra 和 Google Pixel 3 C#

帮助查找滚动脚本或类似方法来滚动到 Android Appium 中的元素。

c# scroll appium-android
2个回答

0
投票

对于“mobile:scroll”,策略和选择器等参数对于 Android UiAutomator2 移动命令是必需的

链接:appium-uiautomator2-driver#mobile-scroll

代码:

Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("strategy", "-android uiautomator");
dic.Add("selector", "UiSelector().textContains(\"Asia\")");

driver.ExecuteScript("mobile: scroll", dic);
© www.soinside.com 2019 - 2024. All rights reserved.