-
Notifications
You must be signed in to change notification settings - Fork 11
Safari Set up
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.
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.
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/