selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Safari can wait indefinitely page load (driver.get command)

Open Malahovskys opened this issue 11 years ago • 11 comments

Safari: 8.0.8 (10600.8.9) MacBook Air: OS X Yosemite 10.10.5 Java: JDK 1.7.0_79-b15 WebDriver: 2.47.1 SafariDriver: 2.45.0

One page of our SUT is loading very long time (>1 hour) and SafariDriver doesn't throw an exception. To be honest it is loaded, but safari says that loading still is in progress.

SafariOptions safariOptions = new SafariOptions();
safariOptions.setUseCleanSession(true);

DesiredCapabilities capabilities = DesiredCapabilities.safari();
capabilities.setCapability(SafariOptions.CAPABILITY, safariOptions);

WebDriver webdriver = new SafariDriver(capabilities);
webdriver.get("http://sut");

I've tried add:

webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.MILLISECONDS);

and

webdriver.manage().timeouts().setScriptTimeout(10, TimeUnit.MILLISECONDS);

but It didn't help.

Malahovskys avatar Oct 07 '15 15:10 Malahovskys

I was not able to reproduce your issue with the same configuration and code. When you load the same page manually, does it load correctly? And in the development tools are there network or js errors?

5hawnknight avatar Oct 07 '15 21:10 5hawnknight

Does SafariDriver throw an exception after long waiting? What time does it wait? As for network or js errors - it may be here, but I guess it should not interfere SafariDriver throw an exception after long waiting anyway.

Malahovskys avatar Oct 08 '15 05:10 Malahovskys

implicitlyWait polls the page until at least one element, since your example doesn't have any WebElements to contend with, it would not keep webdriver from throwing an exception and setScriptTimeout refers to an executeAsyncScript executed by webdriver, again, would not throw an exception. I would suggest using an explicit wait and adjust the timeout accordingly . In addition, if you are using the Grid, there are options/parameters to help in this type of situation.

5hawnknight avatar Oct 08 '15 21:10 5hawnknight

Let me ask about get method of SafariDriver: How long can this method be executed? How can I set a time out for this method?

Malahovskys avatar Oct 09 '15 13:10 Malahovskys

no, there is not a timeout on the get command.

5hawnknight avatar Oct 12 '15 00:10 5hawnknight

I've also seen this kind of issue intermittently, driver is stuck on get command.

Swapnillll avatar Oct 13 '15 19:10 Swapnillll

Are there any way to stop get method after some time out?

Malahovskys avatar Oct 14 '15 08:10 Malahovskys

Not until someone implements it.... https://github.com/SeleniumHQ/selenium/blob/master/javascript/safari-driver/extension/commands.js#L271

lukeis avatar Oct 14 '15 15:10 lukeis

I'm currently experiencing this problem. Any news on this?

gabriellecampos avatar May 09 '16 11:05 gabriellecampos

New link for the task mentioned by @lukeis : https://github.com/SeleniumHQ/selenium/blob/safari/javascript/safari-driver/extension/commands.js#L271

gabriellecampos avatar Jun 17 '16 13:06 gabriellecampos

With the release of Safari 10, Apple now offers official support WebDriver. Because of this, the Selenium project no supports the legacy implementation from 2.x.

Users are advised to switch to Apple's driver and file bugs at https://bugreport.apple.com/

We are no longer tracking issues for Selenium's SafariDriver and thus closing this issue.

lukeis avatar Sep 23 '16 20:09 lukeis