Safari can wait indefinitely page load (driver.get command)
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.
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?
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.
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.
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?
no, there is not a timeout on the get command.
I've also seen this kind of issue intermittently, driver is stuck on get command.
Are there any way to stop get method after some time out?
Not until someone implements it.... https://github.com/SeleniumHQ/selenium/blob/master/javascript/safari-driver/extension/commands.js#L271
I'm currently experiencing this problem. Any news on this?
New link for the task mentioned by @lukeis : https://github.com/SeleniumHQ/selenium/blob/safari/javascript/safari-driver/extension/commands.js#L271
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.