我在通过 appium 自动化 iOS 应用程序时遇到问题。我面临的问题是我们的应用程序在单击应用程序中的某个链接时出现了模态窗口,我需要点击该模态窗口内的某个元素。但我没有成功。
基本上,我的怀疑是模态窗口阻止与模态窗口交互之前的前一个窗口。如果有人可以建议如何切换以与该模式窗口进行交互,那将非常有帮助。
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:30 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestalt.c:528: no access to UniqueDeviceID (see <rdar://problem/11744455>)
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Debug: evaluating au.tapById('14')
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Debug: target.frontMostApp().elements()[0].elements()[15].tap()
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:30 test-iPhone-5s MobileGestaltHelper[79] <Error>: libMobileGestalt MobileGestalt.c:267: server_access_check denied access to question UniqueDeviceID for pid 6174
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Debug: target.frontMostApp().elements()[0].elements()[15] could not be tapped
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:30 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestaltSupport.m:167: pid 6174 (ScriptAgent) does not have sandbox access for re6Zb+zwFKJNlkQTUeT+/w and IS NOT appropriately entitled
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:30 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestalt.c:528: no access to UniqueDeviceID (see <rdar://problem/11744455>)
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Error: VerboseError: elementId 14 could not be tapped
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Error: Error during eval: tapById@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:1114:25
eval code
eval@[native code]
startProcessing@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:2710:30
bootstrap@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:2778:31
global code@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:2787:10
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Debug: responding with:
info: [debug] [INST] 2016-04-21 11:09:30 +0000 Debug: Running system command #47: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":13,"value":"elementId 14 could not be tapped"}...
info: [debug] Socket data received (58 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":13,"value":"elementId 14 could not be tapped"}
info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"elementId 14 could not be tapped"},"sessionId":"b41ebb12-d884-4d83-b3eb-22b25398a183"}
info: <-- POST /wd/hub/session/b41ebb12-d884-4d83-b3eb-22b25398a183/element/14/click 500 1268.862 ms - 201
info: --> POST /wd/hub/session/b41ebb12-d884-4d83-b3eb-22b25398a183/element {"using":"xpath","value":"//UIAApplication[1]/UIAWindow[1]/UIAButton[12]"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: "au.mainApp().getTreeForXML()"
info: [debug] Sending command to instruments: au.mainApp().getTreeForXML()
info: [debug] [INST] 2016-04-21 11:09:31 +0000 Debug: Got new command 47 from instruments: au.mainApp().getTreeForXML()
info: [debug] [INST] 2016-04-21 11:09:31 +0000 Debug: evaluating au.mainApp().getTreeForXML()
info: [debug] [INST] 2016-04-21 11:09:31 +0000 Debug: evaluation finished
info: [debug] [INST] 2016-04-21 11:09:31 +0000 Debug: responding with:":true,"valid":true,"visible":true,"hint":null,"path":"/0/0","x":0,"y":0,"width":320,"height":568},">":[{"UIANavigationBar":{"@":{"name":"test","label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/0","x":0,"y":20,"width":320,"height":44},">":[{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/0/0","x":0,"y":0,"width":320,"height":64},">":[{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/0/0/0","x":0,"y":64,"width":320,"height":0},">":[]}}]}},{"UIAButton":{"@":{"name":"UINavigationBarBackIndicatorDefault.png","label":"Back","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/0/1","x":8,"y":32,"width":12.5,"height":20.5},">":[]}}]}},{"UIAScrollView":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/1","x":8,"y":72,"width":304,"height":436},">":[{"UIAImage":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/1/0","x":40,"y":99,"width":240,"height":84},">":[]}},{"UIAStaticText":{"@":{"name":"Login Request","label":"Login Request","value":"Login Request","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/1/1","x":18,"y":191,"width":284,"height":48},">":[]}},{"UIAStaticText":{"@":{"name":"test","label":"test","value":"test","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/1/2","x":20,"y":259,"width":280,"height":29},">":[]}},{"UIAStaticText":{"@":{"name":"www.test.com","label":"www.test.com","value":"www.test.com","dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/1/3","x":20,"y":290,"width":280,"height":30},">":[]}},{"UIAStaticText":{"@":{"name":null,"label":"","value":"","dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/1/4","x":36,"y":340,"width":244,"height":0},">":[]}}]}},{"UIAImage":{"@":{"name":"darkgrey_shadow_top","label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/2","x":0,"y":508,"width":320,"height":3},">":[]}},{"UIAButton":{"@":{"name":"Approve","label":"Approve","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/3","x":9,"y":520,"width":146.5,"height":39},">":[]}},{"UIAButton":{"@":{"name":"Decline","label":"Decline","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/0/4","x":164.5,"y":520,"width":146.5,"height":39},">":[]}},{"UIAButton":{"@":{"name":"Cancel","label":"Cancel","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/5","x":10,"y":20,"width":72,"height":44},">":[]}},{"UIAStaticText":{"@":{"name":"LabelPinText","label":"LabelPinText","value":"LabelPinText","dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/6","x":8,"y":72,"width":304,"height":214},">":[]}},{"UIAButton":{"@":{"name":"1","label":"1","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/7","x":0,"y":350,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"2","label":"2","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/8","x":107.5,"y":350,"width":105,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"3","label":"3","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/9","x":214.5,"y":350,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"4","label":"4","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/10","x":0,"y":404.5,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"5","label":"5","value":null,"dom":null,"e
nabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/11","x":107.5,"y":404.5,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"6","label":"6","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/12","x":215,"y":404.5,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"7","label":"7","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/13","x":0,"y":459,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"8","label":"8","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/14","x":107.5,"y":459,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"9","label":"9","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/15","x":215,"y":459,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"Forgot PIN","label":"Forgot PIN","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/16","x":0,"y":513.5,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":"0","label":"0","value":null,"dom":null,"enabled":true,"valid":true,"visible":false,"hint":null,"path":"/0/0/17","x":107.5,"y":513.5,"width":105.5,"height":52.5},">":[]}},{"UIAButton":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":false,"valid":true,"visible":false,"hint":null,"path":"/0/0/18","x":215,"y":513.5,"width":105.5,"height":52.5},">":[]}}]}},{"UIAWindow":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1","x":0,"y":0,"width":320,"height":568},">":[{"UIAStatusBar":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0/1/0","x":0,"y":0,"width":320,"height":20},">":[{"UIAElement":{"@":{"name":"No SIM","label":"No SIM","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/1/0/0","x":6,"y":0,"width":42,"height":20},">":[]}},{"UIAElement":{"@":{"name":"3 of 3 Wi-Fi bars","label":"3 of 3 Wi-Fi bars","value":"_TechHub_London","dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/1/0/1","x":53,"y":0,"width":13,"height":20},">":[]}},{"UIAElement":{"@":{"name":"12:09","label":"12:09","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/1/0/2","x":145,"y":0,"width":30,"height":20},">":[]}},{"UIAElement":{"@":{"name":"98% battery power, Charging","label":"98% battery power, Charging","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":"Swipe down with three fingers to reveal the notification center., Swipe up with three fingers to reveal the control center, Double-tap to scroll to top","path":"/0/1/0/3","x":253,"y":0,"width":62,"height":20},">":[]}}]}}]}}]}}}
info: [debug] [INST] 2016-04-21 11:09:31 +0000 Debug: Running system command #48: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"UIAApplication":{"@":{"name":"test-Dev","label":"test-Dev","value":null...
info: [debug] Socket data received (7654 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"UIAApplication":{"@":{"name":"test-Dev","label":"test-Dev","value":null,"dom":null,"enabled":true,"valid":true,"visible":true,"hint":null,"path":"/0","x
":0,"y":20,"width":320,"height":548},">":[{"UIAWindow":{"@":{"name":null,"label":null,"value":null,"dom":null,"enabled
info: [debug] Pushing command to appium work queue: "au.getElementByIndexPath('/0/0/15')"
info: [debug] Sending command to instruments: au.getElementByIndexPath('/0/0/15')
info: [debug] [INST] 2016-04-21 11:09:32 +0000 Debug: Got new command 48 from instruments: au.getElementByIndexPath('/0/0/15')
info: [debug] [INST] 2016-04-21 11:09:32 +0000 Debug: evaluating au.getElementByIndexPath('/0/0/15')
info: [debug] [INST] 2016-04-21 11:09:32 +0000 Debug: evaluation finished
info: [debug] [INST] 2016-04-21 11:09:32 +0000 Debug: Lookup returned [object UIAButton] with the name "9" (id: 15).
info: [debug] [INST] 2016-04-21 11:09:32 +0000 Debug: responding with:
info: [debug] [INST] 2016-04-21 11:09:32 +0000 Debug: Running system command #49: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"ELEMENT":"15"}}...
info: [debug] Socket data received (39 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":{"ELEMENT":"15"}}
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"15"},"sessionId":"b41ebb12-d884-4d83-b3eb-22b25398a183"}
info: <-- POST /wd/hub/session/b41ebb12-d884-4d83-b3eb-22b25398a183/element 200 1774.658 ms - 88 {"status":0,"value":{"ELEMENT":"15"},"sessionId":"b41ebb12-d884-4d83-b3eb-22b25398a183"}
info: --> POST /wd/hub/session/b41ebb12-d884-4d83-b3eb-22b25398a183/element/15/click {}
info: [debug] Pushing command to appium work queue: "au.tapById('15')"
info: [debug] Sending command to instruments: au.tapById('15')
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:34 test-iPhone-5s MobileGestaltHelper[79] <Error>: libMobileGestalt MobileGestalt.c:267: server_access_check denied access to question UniqueDeviceID for pid 6174
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:34 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestaltSupport.m:167: pid 6174 (ScriptAgent) does not have sandbox access for re6Zb+zwFKJNlkQTUeT+/w and IS NOT appropriately entitled
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:34 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestalt.c:528: no access to UniqueDeviceID (see <rdar://problem/11744455>)
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Debug: Got new command 49 from instruments: au.tapById('15')
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Debug: evaluating au.tapById('15')
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Debug: target.frontMostApp().elements()[0].elements()[15].tap()
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:34 test-iPhone-5s MobileGestaltHelper[79] <Error>: libMobileGestalt MobileGestalt.c:267: server_access_check denied access to question UniqueDeviceID for pid 6174
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:34 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestaltSupport.m:167: pid 6174 (ScriptAgent) does not have sandbox access for re6Zb+zwFKJNlkQTUeT+/w and IS NOT appropriately entitled
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:34 test-iPhone-5s ScriptAgent[6174] <Error>: libMobileGestalt MobileGestalt.c:528: no access to UniqueDeviceID (see <rdar://problem/11744455>)
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Debug: target.frontMostApp().elements()[0].elements()[15] could not be tapped
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Error: VerboseError: elementId 15 could not be tapped
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Error: Error during eval: tapById@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:1114:25
eval code
eval@[native code]
startProcessing@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:2710:30
bootstrap@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:2778:31
global code@file:///Applications/Appium.app/Contents/Resources/node_modules/appium/F32B3814-A47F-4C18-AAF1-5A58DE43FD13/bootstrap-5923cadea0343e3f.js:2787:10
info: [debug] Socket data received (58 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":13,"value":"elementId 15 could not be tapped"}
info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"elementId 15 could not be tapped"},"sessionId":"b41ebb12-d884-4d83-b3eb-22b25398a183"}
info: <-- POST /wd/hub/session/b41ebb12-d884-4d83-b3eb-22b25398a183/element/15/click 500 1246.783 ms - 201
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Debug: responding with:
info: [debug] [INST] 2016-04-21 11:09:34 +0000 Debug: Running system command #50: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":13,"value":"elementId 15 could not be tapped"}...
info: --> DELETE /wd/hub/session/b41ebb12-d884-4d83-b3eb-22b25398a183 {}
info: Shutting down appium session
info: [debug] Stopping ios
info: [debug] Destroying instruments client socket.
info: [debug] Closing socket server.
info: [debug] Instruments socket server was closed
info: [debug] Sending sigterm to instruments
info: [debug] [INST] 2016-04-21 11:09:37 +0000 Stopped: Script was stopped by the user
info: [IOS_SYSLOG_ROW ] Apr 21 12:09:37 test-iPhone-5s backboardd[31] <Error>: void IOHIDEventSystemConnectionDispatchEvent(IOHIDEventSystemConnectionRef, IOHIDEventRef): Error enqueuing memory (10000003) for client <IOHIDEventSystemConnection 0x14651f0b0 [0x1962290c0]>{pid=6173 executablePath=test type=Rate Controlled caller=CoreMo