Search code examples
javaselenium-webdriversafarisafaridriver

How to launch Safari with Selenium WebDriver using Java


I have successfully installed safari developer certificate for safari driver. I have been built and added to safari extensions builder. The presteps are done. However when I run my selenium scripts, the safari server starts on a port and then I get following error in my eclipse console as shown below:

Oct 27, 2014 3:49:37 PM org.openqa.selenium.safari.SafariDriverServer start
INFO: Server started on port 22131
java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.openqa.selenium.safari.SafariDriverCommandExecutor
at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:99)
at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:115)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:101)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:94)

The safari browser open with giving error "Safari cant Find the File"

Any help would be appriciated thanks


Solution

  • Hi,
    Setting up Selenium tests to run on Safari browser is a fairly complex process. You need to install Safari Extensions Developer Certificate in your machine and also install selenium webdriver as an extension in Safari Browser.

    Also there are some stability issues with Safari browser automation & Selenium combination on Mac 10.9 OS and below. The stability is much better on Mac Yosemite OSX & Safari 8.0.x combination along with Selenium v2.45.0

    Detailed steps for the setup can be seen here

    Regards,
    VJ