动作类抛出错误无法代理

时间:2018-12-18 07:35:35

标签: appium appium-android

动作类抛出此错误

Action action=null;
action=new Actions(android);    
action.moveToElement(melement).click().build().perform()

点击element / n时出错

  

错误是:处理以下内容时发生未知的服务器端错误:   命令。原始错误:无法代理。代理错误:无法代理   命令到远程服务器。原始错误:501-“未实现   命令:session / 428b7e70ae59c02ea3bfb6da2f404581 / actions“

JavaClient版本:6.0.0 BETA4

Appium:1.10.0

硒服务器:3.9.0**

你知道是什么原因造成的吗?

下面是我的鸦片错误日志

[Chromedriver] UnknownError: An unknown server-side error occurred while 
processing the command. Original error: unknown error: The adb command 
failed. Extra response: <001ddevice 'ZY2239MTHQ' not foundFAIL001ddevice 
offline (no transport)>.
[Chromedriver] (Session info: chrome=70.0.3538.110)
[Chromedriver] (Driver info: chromedriver=2.44.609545 
(c2f88692e98ce7233d2df7c724465ecacfe74df5),platform=Mac OS X 10.13.4 x86_64)
[Chromedriver] at errorFromMJSONWPStatusCode 
(/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base- 
driver/lib/protocol/errors.js:789:10)
[Chromedriver] at ProxyRequestError.getActualError 
(/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base- 
driver/lib/protocol/errors.js:683:14)
[Chromedriver] at JWProxy.command 
(/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base- 
driver/lib/jsonwp-proxy/proxy.js:234:19)

这是否意味着ADB损坏或我的设备?

4 个答案:

答案 0 :(得分:1)

查看日志时首先要考虑的是,日志显示function test() { var data = [{ "assessmentType": "FINAL", "assessCatId": -1, "assessReason": "2", "assessAmount": "", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": -1, "assessReason": "2", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": -1, "assessReason": "", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": null, "assessAmount": "", "assessPenalty": "", "assessTotal": 0 }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": null, "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": "", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": "", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": "2075-09-09", "assessAmount": "2075-09-17", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": "2075-09-09", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 0, "assessReason": "2075-09-17", "assessTotal": null }, { "assessmentType": "FINAL", "assessCatId": 1, "assessReason": "", "assessAmount": "0", "assessPenalty": "0", "assessTotal": 0 }, { "assessmentType": "FINAL", "assessCatId": 2, "assessReason": "", "assessAmount": "0", "assessPenalty": "0", "assessTotal": 0 }, { "assessmentType": "FINAL", "assessCatId": 3, "assessReason": "", "assessAmount": "0", "assessPenalty": "0", "assessTotal": 0 }, { "assessmentType": "FINAL", "assessCatId": 1, "assessReason": "A", "assessAmount": "1", "assessPenalty": "2", "assessTotal": 3 }, { "assessmentType": "FINAL", "assessCatId": 2, "assessReason": "B", "assessAmount": "3", "assessPenalty": "4", "assessTotal": 7 }, { "assessmentType": "FINAL", "assessCatId": 3, "assessReason": "C", "assessAmount": "5", "assessPenalty": "6", "assessTotal": 11 } ] for (var i = 0; i < data.length; i++) { var current_node = data[i]; var filtered = []; if ((current_node.assessCatId >= 1 && current_node.assessCatId <= 3) && (current_node.assessReason != '' && current_node.assessReason != null)) { filtered.push(current_node); } } return filtered; } console.log(JSON.stringify(test())),这意味着即使您的设备已连接到计算机,它也处于脱机状态。

您可以尝试重新连接设备并检查<001ddevice 'ZY2239MTHQ' not foundFAIL001ddevice offline (no transport)>.。此命令必须显示设备的当前状态。

另一点是,使用彼此对应的Appium服务器和Java客户端。

Java客户端adb devices支持

Appium服务器1.10,Java客户端7.0支持服务器1.9.1。因此,请相应地使用这些库。

这里要注意的另一点是,对于Android设备,您使用6.1.0类,而不是Action类;对于iOS设备,您使用AndroidTouchAction类。因此,使用适当的类来查看所需的结果。

也可以考虑使用最新版本的硒罐。

答案 1 :(得分:0)

使用adb卸载并删除此软件包。这对我有用:

adb -s UDID uninstall io.appium.uiautomator2.server
adb -s UDID uninstall io.appium.uiautomator2.server.test
adb -s UDID uninstall io.appium.unlock
adb -s UDID uninstall io.appium.settings

OR

有时也会由于超时而导致此问题。保持睡眠,看看     在每个动作之后。如果可行,请使用适当的等待时间。

答案 2 :(得分:0)

您正在 desiredCapabilities 中使用值为 udid 。无法使用ZY2239MTHQ找到您的设备。确保设备正确连接。 在终端中运行以下命令:

adb devices

此命令将显示连接到计算机的设备。如果您的设备未列出,则必须在设备中启用开发人员选项。

  

请确保您在代码中使用的udid与上述命令显示的udid匹配。

答案 3 :(得分:-1)

也许您要导航的元素不在当前页面上,因为在调用 click()函数之前,请求的页面加载速度不足以加载所需的元素,或者它只是重定向到另一个页面,而您的元素仍未加载。尝试将 wait()函数放在 click()函数之前,等待元素加载。