【问题标题】:Not able to click on hardware Menu button using appium in Java无法在 Java 中使用 appium 单击硬件菜单按钮
【发布时间】:2015-01-12 20:10:02
【问题描述】:

我正在使用 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);
  • 或在这里与专家交流:- gitter.im/appium/appium

标签: java android appium


【解决方案1】:
driver.execute_script("mobile: keyevent", {"keycode": 82})

或者如果上述方法不起作用,试试这个:-

  HashMap swipeObject = new HashMap(); swipeObject.put("keycode", 82);

 ((JavascriptExecutor ) driver).executeScript("mobile: keyevent", swipeObject); 

【讨论】:

  • 嗨@swapnil HashMap swipeObject = new HashMap(); swipeObject.put("keycode", 82); ((JavascriptExecutor) driver).executeScript("mobile: keyevent", swipeObject);为我工作。感谢您的帮助
  • @swapnil 我尝试了你的步骤我可以得到以下错误请指导我.....线程“main”org.openqa.selenium.WebDriverException中的异常:尚未实现。请帮助我们:appium.io/get-involved.html(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:8 毫秒
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-03-26
  • 2012-08-29
  • 1970-01-01
  • 1970-01-01
  • 2015-10-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多