Selenium: Safari webdriver extension 2.48 not running with Safari 9

Created on 22 Oct 2015  Â·  29Comments  Â·  Source: SeleniumHQ/selenium

Hello,

i need some support. Yesterday i updating my macbook to el capitan. In this case i updating may Safari from version 8 to 9 as well. I have writing some testscripts. The problem is, the safari browser will opened but not not call the the desired URL.Safari Browser stops.

System information:
selenium 2.48.2
safari 9.0
TestNG 6.9.6
safari extension 2.48

error trace:

java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
at org.openqa.selenium.safari.WebSocketConnection.send(WebSocketConnection.java:139)
at org.openqa.selenium.safari.SafariDriverCommandExecutor.execute(SafariDriverCommandExecutor.java:188)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.safari.SafariDriver.(SafariDriver.java:62)
at org.openqa.selenium.safari.SafariDriver.(SafariDriver.java:42)
at de.softisticated.testautomatisierung.base.AbstractTest.readProperties(AbstractTest.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

Does somebody has any idea? Thank you.

A-needs new owner D-safari

Most helpful comment

@Merfar did you already download the Webdriver extension and put enable the option in Safari?

http://selenium-release.storage.googleapis.com/index.html?path=2.48/

Download the SafariDriver.safariextz

All 29 comments

bildschirmfoto 2015-10-22 um 09 14 42
bildschirmfoto 2015-10-22 um 09 15 01

The Java WebDriver for Safari fails if Safari is already open or has a window open already. It is good to ensure this is the case and that you do not have anything set to restore windows or anything from the previous Safari session.

This was tripping me up about a week ago and behaves quite differently from other implementations. Ruby Selenium for Safari does not have that problem. There are some deficiencies with the Java Selenium for Safari (and consequently the Python one which just calls the Java... )

Hello uchuugaka,

there is no safari window open before and i perform no restore function. What i can do, i dont get any further

@BerforeClass
@Parameters({ "host" })

this.driver = new SafariDriver();
this.utils = new Utils(this.driver);
driver.get(host);
driver.manage().window().setSize(new Dimension(1024, 850));
if (!utils.getDriver().getTitle().contains("XXXXXXX")) {
Reporter.log("Browser not ready yet => refresh");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
utils.getDriver().navigate().refresh();
}
}

variable host will come from the testng.xml
host = http://192.168.2.1

I tried on Mac 10.11, Safari Version 9.0 (11601.1.56), Webdriver 2.48 and it starts fine....

@msiles
hi mslies,
that is strange! I think you use some other configurations like me. So i would like send you a small video, that shows my problem. My Webdriver starts as well, but the webdriver not continue, it stops. You can see this in the attachments, which i post in my issue.

@Merfar did you already download the Webdriver extension and put enable the option in Safari?

http://selenium-release.storage.googleapis.com/index.html?path=2.48/

Download the SafariDriver.safariextz

yes, exactly from the url, which you did mentioned.If i not install the extension, i will get a error.

@merfar
Does an older version than 2.48 work for you?

On Oct 28, 2015, at 11:25 PM, Merfar [email protected] wrote:

yes, exactly from the url, which you did mentioned.

―
Reply to this email directly or view it on GitHub.

@uchuugaka
i tried with the version 2.45 as well,this fails,too.

I met the same issue

are you running this on mac or windows?

On Sat, Oct 31, 2015 at 8:54 PM, Jerry_Bian [email protected]
wrote:

I met the same issue

—
Reply to this email directly or view it on GitHub
https://github.com/SeleniumHQ/selenium/issues/1185#issuecomment-152789313
.

I sure hope it's on OS X because Safari for Windows was end of lifed some time ago.

On Nov 1, 2015, at 1:49 PM, msiles [email protected] wrote:

are you running this on mac or windows?

On Sat, Oct 31, 2015 at 8:54 PM, Jerry_Bian [email protected]
wrote:

I met the same issue

―
Reply to this email directly or view it on GitHub
https://github.com/SeleniumHQ/selenium/issues/1185#issuecomment-152789313
.

―
Reply to this email directly or view it on GitHub.

Running on MAC os 10.11.1 with safari 9.0.1
This error happens when try to create a new safariDriver()
Selenium-server-standalone-2.48.2.jar

@redbiscuit
Did you get the same error logs from the safari driver like me? Please have a look on my screenshots.

Actually I'm experiencing the same problem, but it happen intermittently.
Mac OSX Yosemite, Selenium Java 2.48.2

I'm facing the same issue using Selenium Java 2.48.2 with Safari 9.0. However, facing with this non constantly.

I am facing similar issue on Mac OS X Yosemite 10.10.4 - Safari 8.0.7. Its working fine with selenium 2.45. After upgrading selenium jars to 2.48 I am seeing this issue.

Hi I am unable to install the Safari extension 2.48 http://selenium-release.storage.googleapis.com/index.html?path=2.48/ on Safari 9.0 El Capitan, it was working fine earlier however I see that after system upgraded to El Capitan version 10.11.1 I am unable to install it. I created Safari extension and installed it, however after few runs the installed webdriver extension gets uninstalled.

The root cause might be the conflict between 2 different versions loaded of dependency "com.google.guava" .

The method "com.google.common.util.concurrent.MoreExecutors.directExecutor" is available since version 18.0 from Guava which is Google Core Libraries For Java.
So if there is another version Guava which is below 18.0 in your java classpath, that might cause the problem, even make it intermittently.
Try to find the lower version Guava, delete, disable or skip it.

For example, if you are using maven, try to run the command to check the dependency tree related with Guava

mvn dependency:tree -Dverbose -Dincludes="com.google.guava"

If there is conflict information as below, you can delete your local repository and add "exclusions" tag in maven pom.xml to skip the conflict dependency.

... ...
 +- xxx.xxx-xxx.xxx:jar:X.X.0:compile

 |  \- com.google.guava:guava:jar:17.0:compile

 \- org.seleniumhq.selenium:selenium-java:jar:2.48.2:compile

    \- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.48.2:compile

       \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.48.2:compile

          +- org.seleniumhq.selenium:selenium-api:jar:2.48.2:compile

         |  \- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 17.0)

         \- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 17.0)
... ...

To skip the guava for the dependency xxx.xxx-xxx.xxx in pom.xml

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>xxx.xxx</groupId>
      <artifactId>xxx.xxx</artifactId>
      <version>X.X.0</version>
      <exclusions>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    ...
  </dependencies>
</project>

@lukeis hi Lukeis,
I've tried your suggestion, to remove duplicated guava library on my code.
I found it duplicate on opera driver and browsermob proxy. but the error still occur.

Thanks @leeyupeng for your comment, updated version of guava and it worked for me.

This was resolve by using
leeyupeng commented on 25 Nov 2015
I just com.google.guava dependency that is not below 18

Have these same issues using webdriver.js

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.

so how do we run automated tests for safari 9 then?

Well using 2.x of course. It's not realistic for all users to be on latest or for all web apps to not support fairly recent browsers. Automation is exactly the right tool to help test multiple configurations, isn't it? 3.x is supposed to also work with an RFC spec that is still changing. Use what works.

On 4 Nov 2016, at 8:14, Zenobius Jiricek [email protected] wrote:

so how do we run automated tests for safari 9 then?

―
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

So, make sure you built the extension with a developer account that can code sign.
If not you have no extension.
If the OS version is too old, well, it may be impossible as code signing rules changed about a year ago requiring new certs be installed and rebuilds.

I build the extension every few months to ensure against this.

Personally, I stick to 2.47.1 as I haven’t found any particular changes in the extension itself since then. (there _might be_ but I haven’t found it.)
I have also forked this branch to keep it and I recommend the same personally if you the native driver does not work for you.
At present, I need to test drag & drop actions and file download & upload. Native driver is too sandboxed.
“Legacy” driver doesn’t exactly support those, so I supplement with the native accessibility APIs to drive those and to handle alerts as well.

On 2015 Oct 22, at 17:02, Merfar [email protected] wrote:

Hello uchuugaka,

there is no safari window open before and i perform no restore function. What i can do, i dont get any further

—
Reply to this email directly or view it on GitHub https://github.com/SeleniumHQ/selenium/issues/1185#issuecomment-150138648.

Was this page helpful?
0 / 5 - 0 ratings