Enabling safaridriver support on macOS

To run browser tests in Safari, the Apple-provided safaridriver needs to be enabled before interaction with Safari can take place. Without enabling this, you may run into the following type of errors:

SessionNotCreatedError: Could not create a session: You must enable the 'Allow Remote Automation' option in Safari's Develop menu to control Safari via WebDriver.
    at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:517:15)
    at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:655:13)
    at Executor.execute (node_modules/selenium-webdriver/lib/http.js:581:28)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

To resolve this, simply run the following near the start of your job:

- run: defaults write com.apple.Safari AllowRemoteAutomation 1

If this alone does not resolve the issue, try adding the following additional command directly afterwards:

- run: sudo safaridriver --enable
Was this article helpful?
0 out of 0 found this helpful