From 554796acbef71018e6e342f36d8b40e3914deb9e Mon Sep 17 00:00:00 2001 From: Philip Walton Date: Mon, 4 Feb 2019 13:34:03 -0800 Subject: [PATCH] Add temp fix for Safari 12+ (#113) --- src/local-browsers/safari.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/local-browsers/safari.js b/src/local-browsers/safari.js index ce143f4..01d5348 100644 --- a/src/local-browsers/safari.js +++ b/src/local-browsers/safari.js @@ -18,6 +18,7 @@ const fs = require('fs'); const webdriver = require('selenium-webdriver'); +const safari = require('selenium-webdriver/safari'); const LocalBrowser = require('../browser-models/local-browser.js'); const SafariConfig = require('../webdriver-config/safari.js'); @@ -54,12 +55,19 @@ class LocalSafariBrowser extends LocalBrowser { const seleniumOptions = this.getSeleniumOptions(); seleniumOptions.setTechnologyPreview((this._release === 'beta')); - const builder = new webdriver + let builder = new webdriver .Builder() .withCapabilities(this._capabilities) .forBrowser(this.getId()) .setSafariOptions(seleniumOptions); + // Run safari 12+ in legacy mode until this is resolved: + // https://github.com/SeleniumHQ/selenium/issues/6026 + if (this.getVersionNumber() >= 12) { + builder = builder.usingServer( + new safari.ServiceBuilder().addArguments('--legacy').build().start()); + } + return builder; }