Macaca_iOS_Java: macaca升级后,在执行用例的过程中,没法定位元素
-
Macaca Version: 2.0.1
-
Macaca Doctor Logs: macaca-doctor version: 2.0.0
Node.js checklist:
node env: /usr/local/bin/node node version: v7.6.0
iOS checklist:
Xcode is installed at:
/Applications/Xcode.app/Contents/DeveloperXcode Command Line Tools is ready, version: 2347. xcodebuild version: 8.3.2 iproxy[usbmuxd] is installed at:/usr/local/bin/iproxyios_webkit_debug_proxy is installed at:/usr/local/bin/ios_webkit_debug_proxycarthage is installed, version: 0.23.0Android checklist:
JAVA version is
1.8.0_121JAVA_HOME is set to/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/HomeANDROID_HOME is set to/Users/wn/Library/Android/sdkPlatforms is set to/Users/wn/Library/Android/sdk/platforms/android-25ADB tool is set to/Users/wn/Library/Android/sdk/platform-tools/adbgradle is installed, version: 3.5Installed driver list:
android: 2.0.17 chrome: 1.0.5 electron: 1.1.6 ios: 2.0.10
-
Operate System: Mac 10.12.3
-
Programming Language: Java
macaca升级后,在执行用例的过程中,除了启动页面可以定位到元素,在其他页面,必须要先执行driver.source(),才可以定位元素,不执行这一步,就无法定位
logs:
proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":null,"status":0,"value":{"sessionId":"4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3","capabilities":{"browserName":"IOETestII","device":"iphone","sdkVersion":"10.3","CFBundleIdentifier":"com.gi... responseHandler.js:47:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:01]: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":"{"app":"/var/folders/07/zd3fktb93x38fkd_rn9yp9sc0000gn/T/IOETestII.app/","reuse":3,"platformName":"ios","udid":"8C8BD90F-4A27-43E0-863D-238F47AA3D2F","deviceName":"iPhone 7"}"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:01]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='SDK初始化']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='SDK初始化']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":0,"value":{"ELEMENT":"5033FD97-F605-4501-815D-4B5EA627E01D","label":"SDK初始化","type":"XCUIElementTypeStaticText"}} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:02]: {"sessionId":"","status":0,"value":"{"ELEMENT":"5033FD97-F605-4501-815D-4B5EA627E01D","label":"SDK初始化","type":"XCUIElementTypeStaticText"}"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:02]: method: GET url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/5033FD97-F605-4501-815D-4B5EA627E01D/displayed, jsonBody: {} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/5033FD97-F605-4501-815D-4B5EA627E01D/displayed:GET to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element/5033FD97-F605-4501-815D-4B5EA627E01D/displayed:GET with body: {} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":true} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:02]: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":"true"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:02]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='SDK初始化']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='SDK初始化']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":0,"value":{"ELEMENT":"CB8D5043-345B-4C65-BDAF-446162A9CFB2","label":"SDK初始化","type":"XCUIElementTypeStaticText"}} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:02]: {"sessionId":"","status":0,"value":"{"ELEMENT":"CB8D5043-345B-4C65-BDAF-446162A9CFB2","label":"SDK初始化","type":"XCUIElementTypeStaticText"}"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:02]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/CB8D5043-345B-4C65-BDAF-446162A9CFB2/click, jsonBody: {} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/CB8D5043-345B-4C65-BDAF-446162A9CFB2/click:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element/CB8D5043-345B-4C65-BDAF-446162A9CFB2/click:POST with body: {} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":0,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:03]: {"sessionId":"","status":0,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:03]: method: GET url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/source, jsonBody: {} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/source:GET to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/source:GET with body: {} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":"{\n "isEnabled" : true,\n "name" : "IOETestII",\n "value" : "",\n "isVisible" : true,\n "rect" : {\n "... session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:03]: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":""{\n \"isEnabled\" : true,\n \"name\" : \"IOETestII\",\n \"value\" : \"\",\n \"isVisible\" : true,\n \"rect\" : {\n \"height\" : 667,\n \"x\" : 0,\n \"y\" : 0,\n \"width\" : 375\n },\n \"type\" : \"Application\",\n \"frame\" : \"{{0, 0}, {375, 667}}\",\n \"children\" : [\n {\n \"children\" : [\n {\n \"children\" : [\n {\n \"ch..."} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:03]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='setLogLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='setLogLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":0,"value":{"ELEMENT":"CC5E4EE5-816A-45A3-8071-D54010631AD0","label":"setLogLevel","type":"XCUIElementTypeStaticText"}} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:04]: {"sessionId":"","status":0,"value":"{"ELEMENT":"CC5E4EE5-816A-45A3-8071-D54010631AD0","label":"setLogLevel","type":"XCUIElementTypeStaticText"}"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:04]: method: GET url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/CC5E4EE5-816A-45A3-8071-D54010631AD0/displayed, jsonBody: {} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/CC5E4EE5-816A-45A3-8071-D54010631AD0/displayed:GET to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element/CC5E4EE5-816A-45A3-8071-D54010631AD0/displayed:GET with body: {} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":true} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:04]: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0,"value":"true"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:04]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='setLogLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='setLogLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":0,"value":{"ELEMENT":"9263ED56-52FB-4677-A27D-1ECBB946ECE1","label":"setLogLevel","type":"XCUIElementTypeStaticText"}} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:04]: {"sessionId":"","status":0,"value":"{"ELEMENT":"9263ED56-52FB-4677-A27D-1ECBB946ECE1","label":"setLogLevel","type":"XCUIElementTypeStaticText"}"} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:04]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/9263ED56-52FB-4677-A27D-1ECBB946ECE1/click, jsonBody: {} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element/9263ED56-52FB-4677-A27D-1ECBB946ECE1/click:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element/9263ED56-52FB-4677-A27D-1ECBB946ECE1/click:POST with body: {} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":0,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:06]: {"sessionId":"","status":0,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:06]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":7,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:06]: {"sessionId":"","status":7,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:06]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":7,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:06]: {"sessionId":"","status":7,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:06]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":7,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:06]: {"sessionId":"","status":7,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:06]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":7,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:06]: {"sessionId":"","status":7,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:06]: method: POST url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element, jsonBody: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:55:14 [master] pid:6911 Proxy: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891/element:POST to http://localhost:8901/wd/hub/session/4EA2657E-2D7D-4AB3-B3C6-52DCBBEA5FD3/element:POST with body: {"using":"xpath","value":"//[@name='logPrintLevel']"} proxy.js:83:20 [master] pid:6911 Got response with status 200: {"sessionId":"","status":7,"value":""} session.js:107:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:07]: {"sessionId":"","status":7,"value":""} responseHandler.js:11:12 [master] pid:6911 Recieve HTTP Request from Client[2017-05-26 16:52:07]: method: DELETE url: /wd/hub/session/c45af24f-1835-4f22-9add-9bb2493fe891, jsonBody: {} macaca-ios.js:348:10 [master] pid:6911 Stoping iOS driver... xctest-client.js:257:14 [master] pid:6911 killing deviceLogProc pid: 6928 xctest-client.js:262:14 [master] pid:6911 killing runnerProc pid: 6927 macaca-ios.js:372:10 [master] pid:6911 iOS driver cleaned up. session.js:80:12 [master] pid:6911 Delete session, sessionId: c45af24f-1835-4f22-9add-9bb2493fe891 responseHandler.js:47:14 [master] pid:6911 Send HTTP Respone to Client[2017-05-26 16:52:07]: {"sessionId":"c45af24f-1835-4f22-9add-9bb2493fe891","status":0} xctest-client.js:109:18 [master] pid:6911 simulator log process exit with code: null, signal: SIGKILL xctest-client.js:185:14 [master] pid:6911 xctest client exit with code: null, signal: SIGKILL
@xudafeng 这个问题有人看下吗?
@wynanwong 换完整路径试试呢
@xudafeng 完整路径的话,加5s等待时间就可以定位到,用name的话,加20s等待时间也不行。
等5s说明你的元素还没加载,name看来就是选择不到,这个属性值不应该是desc-content?
@xudafeng 问题是执行driver.source()这条语句后,用name是可以选择到的
@wynanwong ok 了解了
@zhuyali https://travis-ci.org/macaca-sample/sample-nodejs/jobs/241500953#L2750 这个问题顺便解决
@xudafeng 把macaca升到最新版本后,这个问题消失了。
@xudafeng 我macaca升级到最新版本,使用xpath定位不到元素,执行driver.source()并且还加了等待还是定位不到元素
macaca-doctor version: 2.0.1
Node.js checklist:
node env: /usr/local/bin/node node version: v7.10.0
iOS checklist:
Xcode Command Line Tools require version: 2347 and above
xcodebuild version: 8.3.3
iproxy[usbmuxd] is installed at: /usr/local/bin/iproxy
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy
carthage is installed, version: 0.23.0
Android checklist:
JAVA version is 1.8.0_102
JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
ANDROID_HOME is set to /usr/local/opt/android-sdk
Platforms is set to /usr/local/opt/android-sdk/platforms/android-25
ADB tool is set to /usr/local/opt/android-sdk/platform-tools/adb
gradle is installed, version: 3.5
Installed driver list:
android: 2.0.17 [out-of-date] electron: 1.1.6 ios: 2.0.22
是不是xpath定位有bug呀