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
- 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 .
More articles
fromStephan Kepser
Your job at codecentric?
Jobs
Agile Developer und Consultant (w/d/m)
Alle Standorte
More articles in this subject area
Discover exciting further topics and let the codecentric world inspire you.
Gemeinsam bessere Projekte umsetzen.
Wir helfen deinem Unternehmen.
Du stehst vor einer großen IT-Herausforderung? Wir sorgen für eine maßgeschneiderte Unterstützung. Informiere dich jetzt.
Hilf uns, noch besser zu werden.
Wir sind immer auf der Suche nach neuen Talenten. Auch für dich ist die passende Stelle dabei.
Blog author
Stephan Kepser
Senior IT Consultant, Cloud and Data Architect
Do you still have questions? Just send me a message.
Do you still have questions? Just send me a message.