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

Safari issues #406

Closed
johannesjo opened this issue Jan 14, 2014 · 7 comments
Closed

Safari issues #406

johannesjo opened this issue Jan 14, 2014 · 7 comments

Comments

@johannesjo
Copy link

When running safari (doesn't matter, if via sauce or via selenium grid), I keep encountering the following error (lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1549):

    Warning: 
    /home/xxxx/node/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1549
          throw error;
                ^
    Error while running testForAngular: Detected a page unload event; script execution does not work across page loads. (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 563 milliseconds
    Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
    System info: host: 'itako18042.miso', ip: '172.20.18.42', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9', java.version: '1.7.0_45'
    Session ID: null
    Driver info: org.openqa.selenium.safari.SafariDriver
    Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=7.0}] Used --force, continuing.

Is this a bug of the webddriver or does this have something to do with protractor?

@juliemr
Copy link
Member

juliemr commented Jan 14, 2014

Hm. Related to #73?
Or #85? That one's on my plate for more investigation after this week.

@johannesjo
Copy link
Author

I probably should mention that I'm running this from Ubuntu and over https (although I'm almost sure I tried with http as well) ... I will play around a little with all route stuff when I get home.

@juliemr
Copy link
Member

juliemr commented Jan 16, 2014

I'm able to reproduce about 0.1% of the time with safari, which is making this a little tricky to debug. But it's a start...

@johannesjo
Copy link
Author

@juliemr sorry for the late reply. Was a hell of a week ;)

Actually the error won't occur, if I use http instead of https. I will debug this further and let you know what I find out.

@johannesjo
Copy link
Author

Well I'm not sure whats going on. From sauce I get the following message:

Test did not see a new command for 90 seconds. Timing out.

The url including the hash is displayed correctly in the address-bar when I'm watching the test-session live, but angulars route doesn't seem to be triggered (not the default view nor the specified one). When I dont watch the test-session and just access it afterwards from the sauce backend only about:blank is shown in the address bar.

These are the commands which get exectued:

POST timeouts/async_script

ms: 120000

=> ok

12.61s (+0.03s)
POST url

url: "about:blank"

=> ok

13.12s (+0.04s)
POST execute

args: []
script: "window.name = \"NG_DEFER_BOOTSTRAP!\" + window.name;window.location.href = \"https://this-is-the-url.com/#/this-is-the-hash\""

=> null

13.71s (+0.04s)
POST execute_async

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 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(null, arguments);"

=> Detected a page unload event; script execution does not work across page loads. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 509 milliseconds Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_45' Session ID: null Driver info: org.openqa.selenium.safari.SafariDriver Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=6.0.5}]

And this is the selenium log:

1INFO: Launching a standalone server
208:58:39.796 INFO - Java: Apple Inc. 20.45-b01-451
308:58:39.798 INFO - OS: Mac OS X 10.8.4 x86_64
408:58:39.823 INFO - v2.33.0, with Core v2.33.0. Built from revision 4e90c97
508:58:39.980 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4443/wd/hub
608:58:39.981 INFO - Version Jetty/5.1.x
708:58:39.982 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
808:58:39.983 INFO - Started HttpContext[/selenium-server,/selenium-server]
908:58:39.983 INFO - Started HttpContext[/,/]
1008:58:40.041 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@571a75a2
1108:58:40.041 INFO - Started HttpContext[/wd,/wd]
1208:58:40.054 INFO - Started SocketListener on 0.0.0.0:4443
1308:58:40.054 INFO - Started org.openqa.jetty.jetty.Server@42698403
1408:58:41.635 INFO - Executing: [new session: {browserName=safari, webdriver.remote.quietExceptions=true}] at URL: /session)
1508:58:41.663 INFO - Creating a new session for Capabilities [{browserName=safari, webdriver.remote.quietExceptions=true}]
1608:58:41.782 INFO - Server started on port 13407
1708:58:43.362 INFO - Connection opened
1808:58:43.436 INFO - Done: /session
1908:58:43.460 INFO - Executing: [execute script: window.moveTo(0,0);window.resizeTo(screen.width,screen.height);, []] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/execute)
2008:58:43.495 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/execute
2108:58:43.502 INFO - Executing: [maximise window] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/window/current/maximize)
2208:58:43.543 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/window/current/maximize
2308:58:43.560 INFO - Executing: [get window handles] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/window_handles)
2408:58:43.574 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/window_handles
2508:58:44.019 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@68acfc3 at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6)
2608:58:44.019 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6
2708:58:44.486 INFO - Executing: [set script timeoutt: 120000] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/timeouts/async_script)
2808:58:44.504 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/timeouts/async_script
2908:58:44.991 INFO - Executing: [get: about:blank] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/url)
3008:58:45.024 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/url
3108:58:45.577 INFO - Executing: [execute script: window.name = "NG_DEFER_BOOTSTRAP!" + window.name;window.location.href = "https://my-url-com/#/my-hash", []] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/execute)
3208:58:45.612 INFO - Done: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/execute
3308:58:46.178 INFO - Executing: [execute async script: return (function () {
34 var attempts = arguments[0];
35 var callback = arguments[arguments.length - 1];
36 var check = function(n) {
37 try {
38 if (window.angular && window.angular.resumeBootstrap) {
39 callback([true, null]);
40 } else if (n < 1) {
41 if (window.angular) {
42 callback([false, 'angular never provided resumeBootstrap']);
43 } else {
44 callback([false, 'retries looking for angular exceeded']);
45 }
46 } else {
47 window.setTimeout(function() {check(n - 1)}, 1000);
48 }
49 } catch (e) {
50 callback([false, e]);
51 }
52 };
53 check(attempts);
54}).apply(null, arguments);, [10]] at URL: /session/fbca7895-d88c-4057-8a04-e8cefc9c64a6/execute_async)
5508:58:46.692 WARN - Exception thrown
56org.openqa.selenium.WebDriverException: Detected a page unload event; script execution does not work across page loads. (WARNING: The server did not provide any stacktrace information)
57Command duration or timeout: 509 milliseconds
58Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
59System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_45'
60Session ID: null
61Driver info: org.openqa.selenium.safari.SafariDriver
62Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=6.0.5}]
63  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
64  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
65  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
66  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
67  at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
68  at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
69  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
70  at org.openqa.selenium.remote.RemoteWebDriver.executeAsyncScript(RemoteWebDriver.java:481)
71  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
72  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
73  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
74  at java.lang.reflect.Method.invoke(Method.java:597)
75  at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
76  at com.sun.proxy.$Proxy1.executeAsyncScript(Unknown Source)
77  at org.openqa.selenium.support.events.EventFiringWebDriver.executeAsyncScript(EventFiringWebDriver.java:221)
78  at org.openqa.selenium.remote.server.handler.ExecuteAsyncScript.call(ExecuteAsyncScript.java:55)
79  at org.openqa.selenium.remote.server.handler.ExecuteAsyncScript.call(ExecuteAsyncScript.java:1)
80  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
81  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
82  at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
83  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
84  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
85  at java.lang.Thread.run(Thread.java:680)
8608:58:46.696 WARN - Exception: Detected a page unload event; script execution does not work across page loads. (WARNING: The server did not provide any stacktrace information)
87Command duration or timeout: 509 milliseconds
88Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
89System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_45'
90Session ID: null
91Driver info: org.openqa.selenium.safari.SafariDriver
92Capabilities [{platform=MAC, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=6.0.5}]

Please let me know, if I could provide some more information.

@johannesjo
Copy link
Author

This is definitely related to routing somehow. When I comment out any occurrences of browser.get() everything is running fine even with https. Still not sure if this is an issue of the webdriver or related to protractor.

@khamasaki
Copy link

Hi - I was running into this problem too and upgraded to 0.17.0 for this fix. While it does seem to fix the page unload event error, I am now intermittently running into the following issue:

     Error: Wait timed out after 303ms
==== async task ====
    at Protractor.get (.../node_modules/protractor/lib/protractor.js:658:15)

It seems that if the server is not quick enough to respond to the get request, the timeout will trigger. I tried increasing the timeout (to 1000) and that made everything work. Is there any chance that you can increase that timeout, or make it configurable somehow?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants