Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Protractor with Appium on iOS not working correctly #1736

Closed

Description

@mindmelting

Protractor tests work fine on Android, but with Appium on iOS it uses SafariLauncher and navigates to my angular app, but it never seems to load the app and I just get a gray screen. If I hit refresh the app loads fine though.

The angular app uses requirejs and is manually bootstrapped to a div element, so I configure rootElement in my configuration.

If I use java to write tests, they run fine and the app launches...hence I think it is a Protractor issue...

This is the logs that get output from my selenium grid instance...

info: [debug] Navigating to most recently opened webview
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
info: [debug] Picking webview WEBVIEW_1
info: [debug] Attempting to set context to 'WEBVIEW_1'
info: [debug] [REMOTE] Debugger web socket connected to url [ws://localhost:27753/devtools/page/1]
info: [debug] [REMOTE] Unregistering from page readiness notifications
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId 0cdf0798-8a56-403e-8554-33bff0f27c59
info: <-- POST /wd/hub/session 303 13191.439 ms - 9 
info: --> GET /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59 {}
info: [debug] Responding to client with success: {"status":0,"value":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"safari","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"warnings":{},"desired":{"count":1,"deviceName":"SPRING iPhone 6","platformName":"iOS","browserName":"safari","deviceImages":"{\"selfie\":\"IMAG0007.jpg\",\"frontId\":\"IMAG0006.jpg\",\"backId\":\"IMAG0007.jpg\"}","deviceImagePath":"/storage/emulated/0/DCIM/100MEDIA/","version":"8.0.2"},"count":1,"deviceName":"SPRING iPhone 6","platformName":"iOS","deviceImages":"{\"selfie\":\"IMAG0007.jpg\",\"frontId\":\"IMAG0006.jpg\",\"backId\":\"IMAG0007.jpg\"}","deviceImagePath":"/storage/emulated/0/DCIM/100MEDIA/","version":"8.0.2","safari":true},"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- GET /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59 200 1.519 ms - 816 {"status":0,"value":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"safari","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"warnings":{},"desired":{"count":1,"deviceName":"SPRING iPhone 6","platformName":"iOS","browserName":"safari","deviceImages":"{\"selfie\":\"IMAG0007.jpg\",\"frontId\":\"IMAG0006.jpg\",\"backId\":\"IMAG0007.jpg\"}","deviceImagePath":"/storage/emulated/0/DCIM/100MEDIA/","version":"8.0.2"},"count":1,"deviceName":"SPRING iPhone 6","platformName":"iOS","deviceImages":"{\"selfie\":\"IMAG0007.jpg\",\"frontId\":\"IMAG0006.jpg\",\"backId\":\"IMAG0007.jpg\"}","deviceImagePath":"/storage/emulated/0/DCIM/100MEDIA/","version":"8.0.2","safari":true},"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: --> POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/timeouts/async_script {"ms":11000}
info: [debug] Set iOS async script timeout to 11000ms
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/timeouts/async_script 200 2.258 ms - 76 {"status":0,"value":null,"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: --> POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/url {"url":"about:blank"}
info: [debug] [REMOTE] Navigating to new URL: about:blank
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Page.navigate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"url":"about:blank"},"id":1}...]
Debugger web socket received data :  {"result":{},"id":1}
info: [debug] [REMOTE] Debugger got a message for 'Page.navigate' and have no handler, doing nothing.
info: [debug] [REMOTE] Waiting for frame navigated...
info: --> GET /wd/hub/status {}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 0.958 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 0.964 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 1.001 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 0.919 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 0.718 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"7cd78df062b480dbde79331b320e6c7147af6788"},"isShuttingDown":false},"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- GET /wd/hub/status 200 2.223 ms - 178 {"status":0,"value":{"build":{"version":"1.3.4","revision":"7cd78df062b480dbde79331b320e6c7147af6788"},"isShuttingDown":false},"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: [debug] [REMOTE] Frame navigated, calling cbs
info: [debug] [REMOTE] Waiting for dom...
info: [debug] [REMOTE] Page loaded, verifying whether ready through readyState
info: [debug] [REMOTE] Checking document readyState
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function (){return document.readyState;})()","ret...]
Debugger web socket received data :  {"result":{"result":{"type":"string","value":"complete"},"wasThrown":false},"id":2}
info: [debug] [REMOTE] readyState was complete
info: [debug] [REMOTE] Page is ready, calling onload cbs
info: [debug] Responding to client with success: {"status":0,"value":"","sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/url 200 2040.351 ms - 74 {"status":0,"value":"","sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: --> POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute {"script":"window.name = \"NG_DEFER_BOOTSTRAP!\" + window.name;window.location.replace(\"http://10.36.160.234:8080/portalserver/spring/index#\");","args":[]}
info: [debug] [REMOTE] Executing 'execute_script' atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){var g=this;\nfunctio...]
Debugger web socket received data :  {"result":{"result":{"type":"object","value":{"status":0,"value":null}},"wasThrown":false},"id":3}
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute 200 21.480 ms - 76 {"status":0,"value":null,"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: --> POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute {"script":"return window.location.href;","args":[]}
info: [debug] [REMOTE] Executing 'execute_script' atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){var g=this;\nfunctio...]
Debugger web socket received data :  {"result":{"result":{"type":"object","value":{"status":0,"value":"about:blank"}},"wasThrown":false},"id":4}
info: [debug] Responding to client with success: {"status":0,"value":"about:blank","sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute 200 19.557 ms - 85 {"status":0,"value":"about:blank","sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: --> POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute {"script":"return window.location.href;","args":[]}
info: [debug] [REMOTE] Executing 'execute_script' atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){var g=this;\nfunctio...]
Debugger web socket received data :  {"result":{"result":{"type":"object","value":{"status":0,"value":"http://10.36.160.234:8080/portalserver/spring/index#"}},"wasThrown":false},"id":5}
info: [debug] Responding to client with success: {"status":0,"value":"http://10.36.160.234:8080/portalserver/spring/index#","sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute 200 22.422 ms - 126 {"status":0,"value":"http://10.36.160.234:8080/portalserver/spring/index#","sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: --> POST /wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/execute_async {"script":"try { return (function (attempts, asyncCallback) {\n  var callback = function(args) {\n    setTimeout(function() {\n      asyncCallback(args);\n    }, 0);\n  };\n  var check = function(n) {\n    try {\n      if (window.angular && window.angular.resumeBootstrap) {\n        callback([true, null]);\n      } else if (n < 1) {\n        if (window.angular) {\n          callback([false, 'angular never provided resumeBootstrap']);\n        } else {\n          callback([false, 'retries looking for angular exceeded']);\n        }\n      } else {\n        window.setTimeout(function() {check(n - 1);}, 1000);\n      }\n    } catch (e) {\n      callback([false, e]);\n    }\n  };\n  check(attempts);\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }","args":[10]}
info: [debug] Response url for executeAsync is http://0.0.0.0:4724/wd/hub/session/0cdf0798-8a56-403e-8554-33bff0f27c59/receive_async_response
info: [debug] [REMOTE] Executing atom in default context
info: [debug] [REMOTE] Sending javascript command
info: [debug] [REMOTE] Remote debugger data sent [{"method":"Runtime.evaluate","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"expression":"(function(){return function(){var l=this;\nfunctio...]
Debugger web socket received data :  {"result":{"result":{"type":"undefined"},"wasThrown":false},"id":6}
info: --> GET /wd/hub/status {}
info: --> GET /wd/hub/status {}
info: --> GET /wd/hub/status {}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wdinfo: <-- GET /wd/hub/status 200 0.847 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 1.006 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
/hub/status 200 1.063 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 1.256 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: <-- GET /wd/hub/status 200 0.991 ms - 104 {"status":0,"value":{"build":{"version":"1.3.4","revision":"c8c79a85fbd6870cd6fc3d66d038a115ebe22efe"}}}
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.4","revision":"7cd78df062b480dbde79331b320e6c7147af6788"},"isShuttingDown":false},"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: <-- GET /wd/hub/status 200 0.955 ms - 178 {"status":0,"value":{"build":{"version":"1.3.4","revision":"7cd78df062b480dbde79331b320e6c7147af6788"},"isShuttingDown":false},"sessionId":"0cdf0798-8a56-403e-8554-33bff0f27c59"}
info: [debug] atom did not return yet, checking to see if we are blocked by an alert
info: [debug] Pushing command to appium work queue: "au.alertIsPresent()"
info: [debug] Sending command to instruments: au.alertIsPresent()

Activity

  1. mindmelting commented on Jan 19, 2015

    @mindmelting
    Author

    Using ignoreSynchronisation = true, now makes the app display and navigates a bit using my tests, but by.model calls now fail, which makes me think it now hasn't bootstrapped correctly?

  2. juliemr commented on Jan 20, 2015

    @juliemr
    Contributor

    I wonder if the by.model issue is related to #1632 (I thought it was only a problem with selendroid, but maybe appium/ios has an issue as well).

    How does the by.model call fail?

  3. mindmelting commented on Jan 21, 2015

    @mindmelting
    Author

    It fails with this stackstrace when using

    browser.manage().timeouts().implicitlyWait(25000);
    browser.ignoreSynchronization = true;
    

    NoSuchElementError: No element found using locator: by.model("user.officialAddress.zipCode")

    Just using

    browser.ignoreSynchronization = true;
    

    will not find any elements

    NoSuchElementError: No element found using locator: By.className("btn-primary")
    
  4. juliemr commented on Jan 21, 2015

    @juliemr
    Contributor

    OK just to make sure - you're absolutely sure that this item does in fact exist on the page? Have you tried putting in a sleep statement (I'm not sure if implicit wait will wait for custom element selectors, I will look into that and report back) before looking by model?

  5. mindmelting commented on Jan 21, 2015

    @mindmelting
    Author

    Yep, like I say the tests work perfectly on Android, it is only on iOS that this is an issue.

    I will check when I get back into work tomorrow if the sleep statement makes a difference.

    Thanks for your help :)

  6. juliemr commented on Mar 17, 2015

    @juliemr
    Contributor

    Any update?

  7. cosminduracsv commented on Mar 18, 2015

    @cosminduracsv

    @juliemr - I have a similar problem, my angular app is launched in browser using safari launcher on an iPad but when i'm trying to use element(by.) i get an error in appium that says something like this 👍
    var el = document.querySelector(rootSelector);\n\n try {\n if (!window.angular) {\n throw new Error('angular could not be found on the window');
    After that all the tests are blocked and the driver never quits.
    If i use browser.driver.findElement(by.) it works just fine.
    What do you think?

  8. juliemr commented on Apr 2, 2015

    @juliemr
    Contributor

    I haven't heard any updates on the original issue, so I'm closing this. Please open a fresh issue with a reproducible test case if you believe there is a bug with Protractor.

  9. bmsoko commented on Jun 11, 2015

    @bmsoko

    Hi @mindmelting could you please share what you've done for Android? In terms of what config.js do you have and also what test are you doing? I'm facing similar issue here: http://stackoverflow.com/questions/30787588/using-protractor-appium-saucelabs

    Thanks!!

  10. mxth commented on Dec 1, 2015

    @mxth

    I have the same problem. The app cannot launch. Adding browser.ignoreSynchronization = true makes the first page load, but the next calls fail. Here is the appium log when it breaks

    info: --> POST /wd/hub/session/bd7e1efe-0f5b-4af3-ae86-87a8a7aa5fe5/execute {"script":"return (function () {\n    angular.module('protractorBaseModule_', []).\n        config(['$compileProvider', function($compileProvider) {\n          if ($compileProvider.debugInfoEnabled) {\n            $compileProvider.debugInfoEnabled(true);\n          }\n        }]).\n        config(['$provide', function($provide) {\n          $provide.decorator('$timeout', ['$delegate', function($delegate) {\n            var $timeout = $delegate;\n\n            var taskId = 0;\n            if (!window.NG_PENDING_TIMEOUTS) {\n              window.NG_PENDING_TIMEOUTS = {};\n            }\n              \n            var extendedTimeout = function() {\n              var args = Array.prototype.slice.call(arguments);\n              if (typeof(args[0]) !== 'function') {\n                return $timeout.apply(null, args);\n              }\n\n              taskId++;\n              var fn = args[0];\n              window.NG_PENDING_TIMEOUTS[taskId] = fn.toString();\n              var wrappedFn = 
    info: <-- POST /wd/hub/session/bd7e1efe-0f5b-4af3-ae86-87a8a7aa5fe5/execute 500 2.240 ms - 101 
    TypeError: Cannot assign to read only property '4' of true
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions