无法在 Java 中使用 appium 单击硬件菜单按钮



我正在使用Java语言的Appium进行移动原生应用程序的自动化。我想点击硬件菜单按钮

我正在使用以下代码

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("mobile: keyevent", 82);

它给我以下错误消息

An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)(..)

如果我的代码做错了什么,请告诉我。

driver.execute_script("mobile: keyevent", {"keycode": 82})

或者,如果以上不起作用,请尝试此操作:-

  HashMap swipeObject = new HashMap(); swipeObject.put("keycode", 82);
 ((JavascriptExecutor ) driver).executeScript("mobile: keyevent", swipeObject); 

最新更新