OPTIMUS
OPTIMUS

Reputation: 692

How to run selenium script on Safari Browser in Mac Machine

I am having a selenium code which is running successfully on Windows 7 for Safari Browser but when i running similar code in MAc Machine in Safari Browser.

But i am getting error. It is opening new Safari Browser but not hitting the URL. My piece of code is:=

WebDriver driver = new SafariDriver();
driver.get("http://www.google.com"); 

I have also gone through the official website but that is also not working.

Error i am getting is:-Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 45092 ms

Upvotes: 0

Views: 3204

Answers (3)

sudazzle
sudazzle

Reputation: 605

The old SafariDriver implementation is no longer maintained and should not be used. You do not need to download anything besides Safari 10 to get the Apple-developed driver. This article explains everything https://webkit.org/blog/6900/webdriver-support-in-safari-10/

Upvotes: 0

Yesh
Yesh

Reputation: 1

On MAC-System, in Safari browser -safari webdriver will be installed by default.To make selenium scripts to run on safari browser you have to make following settings in browser:

Provide the default setting for the Selenium Webdriver Extension:

  1. Click on “Safari” > “Preferences” > “Extensions” > You will find Selenium extension
  2. Select “Enable Webdriver”

Safari Webdriver setup():

WebDriver driver = new SafariDriver();
driver.get("http://www.google.com");

Now all the settings are done and now we should be able to launch our Selenium scripts using Safari browser

Upvotes: 0

Ant's
Ant's

Reputation: 13811

Its a known bug.

Here is the bug detail

Upvotes: 1

Related Questions