Reputation: 97
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
Upvotes: 2
Views: 35348
Reputation: 73
Starting with Selenium 2.30.0, the SafariDriver comes bundled with the Selenium server. If you wish to build the driver from source, head over to the SafariDriverInternals page. For now, grab a copy of the Selenium jar and add it to your classpath. Writing a test for Safari is just as straightforward as using the FirefoxDriver: To manually install the latest Safari extension (2.43.1): -
-
Download Safari Driver jar from here: http://central.maven.org/maven2/org/seleniumhq/selenium/selenium-safari-driver/2.43.1/selenium-safari-driver-2.43.1.jar. Rename the file to a .zip file instead of a .jar file. Unzip it (just double click on it to do so). In Folder, go to /selenium-safari-driver-2.43.1/org/openqa/selenium/safari. Double click “SafariDriver.safariextz” or simple drag this file in browser.
System.setProperty("webdriver.safari.noinstall", "true"); //To stop uninstall each time
driver = new SafariDriver();
driver.get("Url");
Upvotes: 1
Reputation: 613
In latest Safari (10.0.1 as of today Nov 2016) WebDriver support is turned off by default. To turn on WebDriver support, do the following:
/usr/bin/safaridriver
and complete the authentication prompt.Now safari is ready to run your webdriver scripts. For more details click here
Upvotes: 0
Reputation: 975
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
Upvotes: 5
Reputation: 2326
It might be a problem related to Webdriver version, please use the latest Webdriver version, Safari driver comes bundled with the the Webdriver just like the firefox driver and you could simply invoke the driver using the code below:
SafariOptions options = new SafariOptions();
options.setUseCleanSession(true); //if you wish safari to forget session everytime
dvr = new SafariDriver(options);
Upvotes: 1