selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Can not run any java script in Safari webdriver when the frame is empty

Open para-selenium-bugs opened this issue 11 years ago • 2 comments

Selenium webdriver version: '2.47.1' os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_71' Safari version 7.1.7

Test to reproduce an issue.

WebDriver driver = createSafariDriver();
driver.get("http://localhost:8080/index.html");
WebElement iframe = driver.findElement(By.tagName("iframe"));           
driver.switchTo().frame(0);
WebElement body = driver.findElement(By.tagName("body"));           
((JavascriptExecutor) driver).executeScript("");

Simple HTML to run with test. (since the html tags are not visible see the attached picture) index html

Expected behavior. Do not throw any Exception

Here is the actual Exception

org.openqa.selenium.TimeoutException: Timed out awaiting response to command "executeScript" after 30002 ms (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 30.01 seconds Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44' System info: host: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_71' Session ID: null Driver info: Capabilities [{platform=MAC, cssSelectorsEnabled=true, javascriptEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=7.1.7}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595) at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:504) at SafariTest.testExecuteScript(SafariTest.java:51)

para-selenium-bugs avatar Sep 24 '15 00:09 para-selenium-bugs

This is a known issue first reported in https://code.google.com/p/selenium/issues/detail?id=7586

Safari does not properly initialize browser extensions for non-html pages.

One possible solution, should anyone want to take a stab at it, would be to fail any commands that target a non-html page and would result in the timeout reported above.

jleyba avatar Sep 24 '15 01:09 jleyba

Closing this issue as there's nothing that can be done with the current driver.

Also, we will be dropping the current safaridriver when Safari 10 is released as it will include Apple's WebDriver implementation:

https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_0.html

jleyba avatar Jun 28 '16 23:06 jleyba