I have some web automation for angular.js sites using protractor that I’m trying to get running in iOS. I have things working fine for iOS 8 using both simulators and real devices, but when running on iOS 9 it appears to be completely broken. I am using the latest versions of everything involved (protractor, appium, Xcode, Mac OS X yosemite).
Basically protractor has a waitForAngular method that is called in various spots in order to synchronize with angular and eliminate the need for implicit waiting or element polling. This is implemented via a javascript script that is run via an execute_async call. On iOS 8 this works, but on iOS 9, the callback is never called, which halts test execution, and eventually things timeout given whatever timeout value is being used for the test runner.
Is this a known issue, and does anyone have any idea for a workaround? This makes protractor unusable with appium and iOS 9.
Here’s a relevant snippet from the appium log, which starts with the wait script being run (please let me know if I need to provide anything else):
2015-12-02 11:47:20:358 - info: --> POST /wd/hub/session/95ccb11e-5a00-443c-889b-b702a52d65dd/execute_async {“script”:“try { return (function (rootSelector, callback) {\n var el = document.querySelector(rootSelector);\n\n try {\n if (window.getAngularTestability) {\n window.getAngularTestability(el).whenStable(callback);\n return;\n }\n if (!window.angular) {\n throw new Error(‘angular could not be found on the window’);\n }\n if (angular.getTestability) {\n angular.getTestability(el).whenStable(callback);\n } else {\n if (!angular.element(el).injector()) {\n throw new Error(‘root element (’ + rootSelector + ‘) has no injector.’ +\n ’ this may mean it is not inside ng-app.’);\n }\n angular.element(el).injector().get(’$browser’).\n notifyWhenNoOutstandingRequests(callback);\n }\n } catch (err) {\n callback(err.message);\n }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }”,“args”:[“body”]}
2015-12-02 11:47:20:358 - info: [debug] Response url for executeAsync is http://0.0.0.0:4723/wd/hub/session/95ccb11e-5a00-443c-889b-b702a52d65dd/receive_async_response
2015-12-02 11:47:20:360 - info: [debug] [REMOTE] Executing atom in default context
2015-12-02 11:47:20:360 - info: [debug] [REMOTE] Sending javascript command
2015-12-02 11:47:20:360 - info: [debug] [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2015-12-02 11:47:20:365 - info: [debug] [REMOTE] Receiving data from remote debugger
2015-12-02 11:47:20:365 - info: [debug] [REMOTE] got applicationSentData response
2015-12-02 11:47:25:363 - info: [debug] atom did not return yet, checking to see if we are blocked by an alert
2015-12-02 11:47:25:364 - info: [debug] Pushing command to appium work queue: “au.alertIsPresent()”
2015-12-02 11:47:25:364 - info: [debug] Sending command to instruments: au.alertIsPresent()
2015-12-02 11:47:26:235 - info: [debug] [INST] 2015-12-02 17:47:26 +0000 Debug: Got new command 9 from instruments: au.alertIsPresent()
2015-12-02 11:47:26:241 - info: [debug] [INST] 2015-12-02 17:47:26 +0000 Debug: evaluating au.alertIsPresent()
2015-12-02 11:47:26:246 - info: [debug] [INST] 2015-12-02 17:47:26 +0000 Debug: evaluation finished
2015-12-02 11:47:26:251 - info: [debug] [INST] 2015-12-02 17:47:26 +0000 Debug: responding with:
2015-12-02 11:47:26:256 - info: [debug] [INST] 2015-12-02 17:47:26 +0000 Debug: Running system command #10: /usr/local/Cellar/node/0.12.0/bin/node /Users/chris/git/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:false}…
2015-12-02 11:47:26:281 - info: [debug] Socket data received (28 bytes)
2015-12-02 11:47:26:281 - info: [debug] Socket data being routed.
2015-12-02 11:47:26:281 - info: [debug] Got result from instruments: {“status”:0,“value”:false}
2015-12-02 11:47:26:282 - info: [debug] atom did not return yet, checking to see if we are blocked by an alert
2015-12-02 11:47:26:282 - info: [debug] Pushing command to appium work queue: “au.alertIsPresent()”
2015-12-02 11:47:26:282 - info: [debug] Sending command to instruments: au.alertIsPresent()
2015-12-02 11:47:27:322 - info: [debug] [INST] 2015-12-02 17:47:27 +0000 Debug: Got new command 10 from instruments: au.alertIsPresent()
2015-12-02 11:47:27:329 - info: [debug] [INST] 2015-12-02 17:47:27 +0000 Debug: evaluating au.alertIsPresent()
2015-12-02 11:47:27:334 - info: [debug] [INST] 2015-12-02 17:47:27 +0000 Debug: evaluation finished
2015-12-02 11:47:27:339 - info: [debug] [INST] 2015-12-02 17:47:27 +0000 Debug: responding with:
2015-12-02 11:47:27:345 - info: [debug] [INST] 2015-12-02 17:47:27 +0000 Debug: Running system command #11: /usr/local/Cellar/node/0.12.0/bin/node /Users/chris/git/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:false}…
— info: [debug] atom did not return yet, checking to see if we are blocked by an alert" section repeats about a dozen more times