2014-09-04 46 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