我正在使用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)(..)
如果我的代码中有任何错误,请告诉我。
答案 0 :(得分:2)
driver.execute_script("mobile: keyevent", {"keycode": 82})
如果以上不起作用,请尝试: -
HashMap swipeObject = new HashMap(); swipeObject.put("keycode", 82);
((JavascriptExecutor ) driver).executeScript("mobile: keyevent", swipeObject);