0

我第一次为 android 应用程序运行SELENIUM+JAVA测试。appiumWindows 8.1)我从 Appium 检查器复制了按钮的 ID。我正在尝试单击按钮。

isDisplayed返回truegettext()很好,但是loginBtn.tap(1, 1);在按钮上会出现以下错误

在 Eclipse 控制台上

org.openqa.selenium.WebDriverException:处理命令时发生未知的服务器端错误。

在 Appium 控制台上

信息:[调试] 将命令推送到 appium 工作队列:[“element:getSize”,{“elementId”:“2”}] 信息:[调试] [BOOTSTRAP] [调试] 从客户端获取数据:{“cmd”: "action","action":"element:getSize","params":{"elementId":"2"}} info: [debug] [BOOTSTRAP] [debug] 得到了 ACTION 类型的命令 info: [debug] [ BOOTSTRAP] [debug] 得到命令操作:getSize 信息:[debug] [BOOTSTRAP] [debug] 返回结果:{"status":0,"value":{"width":540,"height":168}} 信息: [debug] 将命令推送到 appium 工作队列:["element:touchDown",{"elementId":"2","x":270,"y":1836}] 信息:[debug] [BOOTSTRAP] [debug ] 从客户端获取数据:{"cmd":"action","action":"element:touchDown","params":{"elementId":"2","x":270,"y":1836}} info: [debug] [BOOTSTRAP] [debug] 得到命令类型ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: touchDown info: [debug] [BOOTSTRAP] [debug] Performing TouchDown using element? true x: 270, y: 1836 info: [debug] [BOOTSTRAP] [错误] 在对象 com.android.uiautomator.core.InteractionController@4c33b 上调用方法私有布尔 com.android.uiautomator.core.InteractionController.touchDown(int,int) 时出错,参数 [270, 1836] 空信息:[调试] [BOOTSTRAP] [调试] 调用 touchDown 时出现问题:java.lang.RuntimeException:在对象 com.android.uiautomator.core 上调用方法私有布尔 com.android.uiautomator.core.InteractionController.touchDown(int,int) 时出错。InteractionController@4c33b 参数为 [270, 1836] 信息:[debug] 以错误响应客户端:{"status":13,"value":{"message":"处理命令时发生未知的服务器端错误。 ","origValue":"未能执行触摸事件"},"sessionId":"797740b8-3fb1-45ae-b31e-1db9aa3e4513"} 信息:<-- POST /wd/hub/session/797740b8-3fb1-45ae- b31e-1db9aa3e4513/touch/perform 500 256.730 ms - 198 info: [debug] [BOOTSTRAP] [debug] 返回结果:{"status":13,"value":"Failed to execute touch event"} info: -->删除 /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513 {} 信息:关闭 appium 会话status":13,"value":{"message":"处理命令时发生未知的服务器端错误。","origValue":"未能执行触摸事件"},"sessionId":"797740b8-3fb1 -45ae-b31e-1db9aa3e4513"} 信息:<-- POST /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513/touch/perform 500 256.730 ms - 198 信息:[调试] [BOOTSTRAP] [调试]返回结果:{"status":13,"value":"未能执行触摸事件"} info: --> DELETE /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513 {} info: 正在关机应用程序会话status":13,"value":{"message":"处理命令时发生未知的服务器端错误。","origValue":"未能执行触摸事件"},"sessionId":"797740b8-3fb1 -45ae-b31e-1db9aa3e4513"} 信息:<-- POST /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513/touch/perform 500 256.730 ms - 198 信息:[调试] [BOOTSTRAP] [调试]返回结果:{"status":13,"value":"未能执行触摸事件"} info: --> DELETE /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513 {} info: 正在关机应用程序会话797740b8-3fb1-45ae-b31e-1db9aa3e4513"} 信息:<-- POST /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513/touch/perform 500 256.730 ms - 198 信息:[调试] [BOOTSTRAP] [debug] 返回结果:{"status":13,"value":"Failed to execute touch event"} info: --> DELETE /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513 {} info : 关闭 appium 会话797740b8-3fb1-45ae-b31e-1db9aa3e4513"} 信息:<-- POST /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513/touch/perform 500 256.730 ms - 198 信息:[调试] [BOOTSTRAP] [debug] 返回结果:{"status":13,"value":"Failed to execute touch event"} info: --> DELETE /wd/hub/session/797740b8-3fb1-45ae-b31e-1db9aa3e4513 {} info : 关闭 appium 会话

4

1 回答 1

0

我解决了:

MobileElement loginBtn=androidDriver.findElementById("com.spotyo.music:id/button_login");
if (loginBtn.isDisplayed()){
    androidDriver.tap(1, loginBtn, 1);      
}
于 2017-01-22T18:41:47.620 回答