Running tests in Safari

Lacy Morrow edited this page Dec 5, 2017 · 9 revisions

Getting started

As of Safari 10, if you have Safari installed the safaridriver will be installed in your OS too, nothing extra to install. Support for the legacy safaridriver has been removed in recent versions of Selenium, tracked here.

In previous versions after Selenium 2.45.0, the SafariDriver acts as an extension to the Safari browser which can be downloaded here. The name is 'SafariDriver.safariextz', download the one from the version folder that matches the version of Selenium you're using.

Now, open Safari and from the File menu choose Open File and point Safari to the SafariDriver extension package you just downloaded. Make sure it's enabled (should be by default).

You can now use Safari as you would any other browser; just set the browserName to safari in your desiredCapabilities, e.g.:

"desiredCapabilities" : {
  "browserName" : "safari",
  "javascriptEnabled" : true,
  "acceptSslCerts" : true
}

Safari specific capabilities

See the DesiredCapabilities page over at the Selenium Project for Safari specific capability options.