Skip to content

Safari Set up

Roland Stens edited this page Dec 13, 2017 · 9 revisions

Safari now provides native support for the WebDriver API. Starting with Safari 10 on OS X El Capitan and macOS Sierra, Safari comes bundled with a new driver implementation that’s maintained by the Web Developer Experience team at Apple. Safari’s driver is launchable via the /usr/bin/safaridriver executable, and most client libraries provided by Selenium will automatically launch the driver this way without further configuration.

Configure your Mac

As a feature intended for developers, Safari’s WebDriver support is turned off by default. To turn on WebDriver support, do the following:

  • Ensure that the Develop menu is available. It can be turned on by opening Safari preferences (Safari > Preferences in the menu bar), going to the Advanced tab, and ensuring that the Show Develop menu in menu bar checkbox is checked.
  • Enable Remote Automation in the Develop menu. This is toggled via Develop > Allow Remote Automation in the menu bar.
  • Authorize safaridriver to launch the webdriverd service which hosts the local web server. To permit this, run sudo /usr/bin/safaridriver --enable once manually and complete the authentication prompt.

When safaridriver quits immediately after launch when running Safari 10 on El Capitan

Some users reported that they could not get safaridriver to run correctly after installing Safari 10 on El Capitan. The main symptom of this issue is that safaridriver will quit immediately when launched manually via the command line. This happens because a launchd plist used by safaridriver is not automatically loaded. Here’s the workaround:

  • Check the status of the com.apple.webdriverd launchd plist:

launchctl list | grep webdriverd

  • If it's not loaded, use this command to load the launchd plist:

launchctl load /System/Library/LaunchAgents/com.apple.webdriverd.plist

This issue only manifests on El Capitan when installing a newer Safari through an application update instead of an OS update. Users running safaridriver on macOS Sierra should be unaffected.

Information from https://webkit.org/blog/6900/webdriver-support-in-safari-10/

Issues