OS: OSX High Sierra
Selenium Version: 3.14.0
Browser: Safari 12
The implementation of the Safari 12 WebDriver now supports the W3C endpoints by default, which may be causing issues if you're using a Framework like Watir, which aren't compatible yet: https://developer.apple.com/documentation/webkit/macos_webdriver_commands_for_safari_12_and_later
Browser Version: Version 12.0 (13606.2.11)
Usage: safaridriver [options]
--legacy: Use the legacy Selenium WebDriver protocol.
Just found this problem on my CI after upgrading the Safari version. Does anyone know how to hot-fixit it?
I was able to temporarily fix it by updating this file /Users/[user_name]/.rvm/gems/ruby-X.X.X/gems/selenium-webdriver-X.X.X/lib/selenium/webdriver/safari/service.rb
And adding this line:

How is Watir not compatible? It should be, please raise an issue if it is not. Selenium should also be compatible, so are you having issues with it as well?
Closing this as you can already add the --legacy flag, see:
driver = Selenium::WebDriver.for(:safari, driver_opts: {args: '--legacy'})
Or Watir:
browser = Watir::Browser.new(:safari, driver_opts: {args: '--legacy'})
If you have other issues with Selenium and Safari 12, please open a new issue with the details.
Thank you @lmtierney .
It's working by declaring it with the args value:
$driver = Watir::Browser.new(:safari, driver_opts: {args: '--legacy'})
I confirm, the solution works with the Selenium WebDriver. Thanks.
@lmtierney how can this flag be set using the node selenium-webdriver package (v3.6)?
Using the service builder https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/safari_exports_ServiceBuilder.html and the addArguments method.
For further questions, please head over to the selenium user group.
For reference here's how I got it working:
const webdriver = require('selenium-webdriver');
const safari = require('selenium-webdriver/safari');
new webdriver.Builder()
.usingServer(await new safari.ServiceBuilder().addArguments('--legacy').build().start())
.forBrowser('safari')
.build();
The builder API doesn't seem to have a setSafariService method like there are for other browsers (eg setChromeService) so I needed to start the service directly and set it as the server to use.
Thank you @mjdease
new webdriver.Builder()
.usingServer(await new safari.ServiceBuilder().addArguments('--legacy').build().start())
.forBrowser('safari')
.build();
what is that await? Is that the npm package await.js?
@tonyaveniros That's the new JS language feature async/await which is supported in recent versions of node (7.6+ according to MDN).
The DriverService start method returns a promise that resolves with the server url to use.
Using the promises directly, the code would be like:
new safari.ServiceBuilder().addArguments('--legacy').build().start().then((serverUrl) => {
return new webdriver.Builder()
.usingServer(serverUrl)
.forBrowser('safari')
.build();
});
Thanks for that. I'm still a bit turned around on this.
Upgraded to node v8.12.0 and now still getting the error message
.usingServer(await new safari.ServiceBuilder().addArguments('--legacy').build().start())
^^^^^
SyntaxError: missing ) after argument list
Using Promises directly does not seem to work either as the next function returns
driver.wait(function () {
^
TypeError: Cannot read property 'wait' of undefined
I'm wondering if your use case is testing remotely using selenium grid: mine is for testing locally...
Got it working with:
new webdriver.Builder()
.usingServer( new safari.ServiceBuilder().addArguments('--legacy').build().start())
.forBrowser('safari')
.build();
using node v8.12.0
Is there a way to pass this argument to Selenium Standalone Server?
Issue still happening for me when using '--legacy' flag
OS: OSX High Sierra
Safari: 12.0.3
Ruby: 2.3.3
Selenium: 3.4.0
Using 'Capybara' framework with selenium webdriver.
Add argument like suggested above:

But still seeing an issue:
Request body does not contain required parameter 'capabilities'.
/Users/username/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/remote/response.rb:69
Any ideas what im doing wrong ?
Thanks
already answered in #6026 ... see: https://github.com/SeleniumHQ/selenium/issues/6026#issuecomment-468070211
please don't post the same comment in multiple issues.
It looks like Safari 12.1 (which just shipped with macOS 10.14.4) silently removed support for the --legacy argument. The nodejs selenium-webdriver package hasn't been updated since 3.6.0 in October 2017 (except for a 4.0-alpha release in Jan 2018) so I can no longer use selenium to test Safari.
@TheSpyder just noticed the same. I'm also now unable to get my tests running for Safari 12.1. I'd love to hear if you find a solution.
@philipwalton until there are signs that selenium wants to update their nodejs bindings, we're working on a rewrite to https://webdriver.io
The JS bindings marked as 4.0.0-alpha-1 are stable. The maintainer marked them this way as we've not yet shipped Selenium 4.0 itself. We'll correct this and ship the updated files to npm.
Most helpful comment
The JS bindings marked as 4.0.0-alpha-1 are stable. The maintainer marked them this way as we've not yet shipped Selenium 4.0 itself. We'll correct this and ship the updated files to npm.