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
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
- 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:
- You’re done.
This post owes much to this selenium issue discussion .
Dein Job bei codecentric?
More articles in this subject area\n
Discover exciting further topics and let the codecentric world inspire you.