protractor icon indicating copy to clipboard operation
protractor copied to clipboard

#85 issue is happening again: Detected a page unload event; asynchronous script execution does not work across page loads.

Open orif opened this issue 12 years ago • 1 comments

I am using a very basic configuration of Protractor and PhantomJS. I was trying to test a sample test in '\protractor\example' folder. I changed capabilities in conf.js: capabilities: { 'browserName': 'phantomjs', 'phantomjs.binary.path': '/path_to_phantomjs/phantomjs.exe' }. Next step is running PhantomJS in web-driver mode, which is phantomjs --webdriver=4444.

To run the example test: protractor "node_modules\protractor\example\conf.js".

I tried selenium also, results are same.

Result: Failures:

  1. angularjs homepage should greet the named user Message: Error: Error while running testForAngular: {"errorMessage":"Detected a page unload event; asynchronous script execution does not work across page loads.","request":{"headers":{"Accept":"application/json, image/png","Connection":"Keep-Alive","Content-Length":"689","Content-Type":"application/json; charset=utf-8","H ost":"localhost:42526"},"httpVersion":"1.1","method":"POST","post":"{"args":[10],"script":"return (function () {\n var attempts = arguments[0];\n var callback = arguments[arguments.length - 1];\n var check = function(n) {\n try {\n if (window.angular && window.angular.resumeBootstrap) {\n c allback([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(null, arguments);"}","url":"/execute_async","urlParsed":{"anchor":"","query":"","file":"execute_async","directory":"/","path":"/execute_async","relative":"/execute_async","port":"","host":"","pas sword":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute_async","queryKey":{},"chunks":["execute_async"]},"urlOriginal":"/session/guid/execute_async"}} Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15' System info: host: 'local', ip: 'xx.xx.xx.xx', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_51'.

EDIT: I am using latest versions of protractor (0.19.0) and phatomjs (1.9.7).

orif avatar Feb 27 '14 21:02 orif

I managed to run successfully with the small change: var ptor = protractor.getInstance(); ptor.driver.get('http://www.angularjs.org');

    element(by.model('yourName')).sendKeys('Julie');
    var greeting = element(by.binding('yourName'));
    expect(greeting.getText()).toEqual('Hello Julie!');

Using ptor.driver solves the issue. I am closing the issue.

orif avatar Feb 27 '14 23:02 orif