Overview

Selenium WebDriver for Safari 8

2 Comments

This is just a short note on how to get the Selenium WebDiver installed and running for the browser Safari (ver. 8) under Mac OS 10.10 “Yosemite”. It isn’t that easy to find the solution on the internet.

Core insight is that you need a WebDriver extension to make it work. Without the extension you get an exception:
WebDriverException: Message: Failed to connect to SafariDriver after 10065 ms
and
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException

So, here are the steps. We use Selenium 2.44.0

  • Download the Selenium stand-alone server selenium-server-standalone-2.44.0.jar from this location.
  • Unpack the jar file in an empty folder. E.g., jar xf selenium-server-standalone-2.44.0.jar.
  • Locate the file SafariDriver.safariextz. It is in org/openqa/selenium/safari
  • Open Safari -> Preferences -> Extensions (tab)
  • Install the extension by dragging the file SafariDriver.safariextz onto the Extensions Tab.
  • Make sure the WebDriver extension is activated.
  • Your extensions window should look like this
    Extensions
  • You can now delete the folder you unpacked the selenium-server-standalone-2.44.0.jar into.
  • Move selenium-server-standalone-2.44.0.jar into some suitable library folder. E.g., create a folder Selenium in /Library and move the file there. Any other place does as well.
  • Finally, you need to set the environment variable SELENIUM_SERVER_JAR to point to selenium-server-standalone-2.44.0.jar (absolute path including jar file name).
    E.g., in a shell: export SELENIUM_SERVER_JAR=/Library/Selenium/selenium-server-standalone-2.44.0.jar.
  • You’re done.

Credits:
This post owes much to this selenium issue discussion.

Kommentare

  • Roberto

    20. April 2015 von Roberto

    Nice article.
    Is there any reason why you use 2.44. Doesn’t it work on 2.45?
    Thanks.

    • Stephan Kepser

      Hi Roberto,

      at the time of writing the Blog post 2.44 was the current Selenium version. That’s why I wrote this. Just use the most recent one.

Comment

Your email address will not be published. Required fields are marked *