2014-09-04 66 views
1

我有一个应用程序,其中有注销按钮,如果UIImage的形式带有齿轮图标。元素名称为settings_icon。我想要做的只是点击该按钮来通过appium调用视图.Appiun能够找到元素,但由于某种原因,它返回时无法点击该元素。以下是日志Appium - 已找到元素但返回错误,因为无法点击

info: <-- POST /wd/hub/session/6ac7b1be-ed67-465e-8a70-0792b65f455e/elements 200 1566.971 ms - 105 {"status":0,"value":[{"ELEMENT":"6"},{"ELEMENT":"7"}],"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e"}

info: --> POST /wd/hub/session/6ac7b1be-ed67-465e-8a70-0792b65f455e/elements {"using":"name","sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e","value":"settings_icon"}

debug: Pushing command to appium work queue: "au.getElementsByName('settings_icon')"

debug: Sending command to instruments: au.getElementsByName('settings_icon') debug: Sending command to instruments: au.getElementsByName('settings_icon')

debug: [INST] 2014-09-04 13:15:39 +0000 Debug: Got new command 16 from instruments: au.getElementsByName('settings_icon')

debug: [INST] 2014-09-04 13:15:39 +0000 Debug: evaluating au.getElementsByName('settings_icon')

debug: [INST] 2014-09-04 13:15:40 +0000 Debug: evaluation finished

debug: [INST] 2014-09-04 13:15:40 +0000 Debug: Lookup returned [object UIAImage] with the name "settings_icon" (id: 8).

debug: [INST] 2014-09-04 13:15:40 +0000 Debug: responding with:

debug: [INST] 2014-09-04 13:15:40 +0000 Debug: Running system command

17: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":[{"ELEMENT":"8"}]}...

debug: Socket data received (40 bytes)

debug: Socket data being routed. debug: Got result from instruments: {"status":0,"value":[{"ELEMENT":"8"}]} debug: Responding to client with success: {"status":0,"value":[{"ELEMENT":"8"}],"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e"}

info: <-- POST /wd/hub/session/6ac7b1be-ed67-465e-8a70-0792b65f455e/elements 200 1450.216 ms - 89 {"status":0,"value":[{"ELEMENT":"8"}],"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e"}

info: --> POST /wd/hub/session/6ac7b1be-ed67-465e-8a70-0792b65f455e/element/8/click {"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e","id":"8"}

debug: Pushing command to appium work queue: "au.tapById('8')"

debug: Sending command to instruments: au.tapById('8') debug: Sending command to instruments: au.tapById('8')

debug: [INST] 2014-09-04 13:15:41 +0000 Debug: Got new command 17 from instruments: au.tapById('8')

debug: [INST] 2014-09-04 13:15:41 +0000 Debug: evaluating au.tapById('8')

debug: [INST] 2014-09-04 13:15:41 +0000 Debug: UIAImage.tap()

debug: [INST] 2014-09-04 13:15:41 +0000 Debug: UIAImage could not be tapped

info: --> GET /wd/hub/status {}

debug: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.1","revision":"2a4b624a708e580709006b697dc4c9c4e3007863"}},"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e"}

info: <-- GET /wd/hub/status 200 1.008 ms - 155 {"status":0,"value":{"build":{"version":"1.2.1","revision":"2a4b624a708e580709006b697dc4c9c4e3007863"}},"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e"}

debug: [INST] 2014-09-04 13:15:41 +0000 Error: VerboseError: elementId 8 could not be tapped

debug: Socket data received (57 bytes)

debug: Socket data being routed. debug: Got result from instruments: {"status":13,"value":"elementId 8 could not be tapped"}

info: <-- POST /wd/hub/session/6ac7b1be-ed67-465e-8a70-0792b65f455e/element/8/click 500 3509.769 ms - 200

debug: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"elementId 8 could not be tapped"},"sessionId":"6ac7b1be-ed67-465e-8a70-0792b65f455e"}

当我手动执行该元素时,该元素是可点击的。我尝试了路径以及元素的名称,但没有运气。即使在Appium检查员找到元素并执行TAP时,它也不起作用。

任何建议将有所帮助。

添加元素的属性由Appium

<UIAImage name="settings_icon" label="" value="" dom="" enabled="true" valid="true" visible="false" hint="" path="/0/0/3" x="0" y="737" width="140" height="22"> 
     </UIAImage> 

回答

1

返回的会不会是你确实有一个UIButton或者是可点击的UIImage的顶部另一UI元素?如果是这样的话,你应该可以通过Appium Inspector查看这个元素。

如果这不起作用,您可以尝试使用精确的水龙头并使用精确的坐标点击该元素。有关如何使用具有坐标的tap命令的信息,请参阅此链接: http://appium.wikia.com/wiki/Mobile_Commands

+0

我检查了结构,但没有找到任何UIButton。但是,我通过使用精确的元素点击来解决问题,并使用精确的水龙头(X和Y坐标)自动化我的脚本。 – slysid 2014-09-05 08:58:34

+0

我将编辑答案以包含精确的点击信息! – 2014-09-05 09:42:55