safaridriver: unrecognized option '--w3c'
Asked 07 September, 2021
Viewed 2.7K times
  • 62
Votes

I'm trying to run a test against safari running on an iPhone in BrowserStack. Using nightwatch test framework. When I launch the runner from my IDE(IntelliJ), I see this error:

/usr/local/bin/node /Users/mike/IdeaProjects/company_front_end/node_modules/nightwatch/bin/runner.js
   Error: SafariDriver process exited with code: 1
   safaridriver: unrecognized option `--w3c'

       at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
 safaridriver: unrecognized option `--w3c'


Process finished with exit code 10

nightwatch.conf.js:

nightwatch_config = {
    selenium : {
        "start_process" : false,
        "host" : "hub-cloud.browserstack.com",
        "port" : 80
    },

    webdriver: {
        start_process: false,
        port: 4444,
        server_path: '/usr/bin/safaridriver',
        cli_args: [
            // very verbose geckodriver logs
            '-vv'
        ]
    },

    test_settings: {
        default: {
            launch_url: 'https://mariner.dev.yembo.ai',
            desiredCapabilities : {
                browserName : 'safari',
                'browserstack.user': 'user',
                'browserstack.key': 'key',
                platformName: 'iOS',
                device: 'iPhone X',
                realMobile: true,
                acceptSslCerts: true,
                //'browser': 'chrome',
                'name': 'Bstack-[Nightwatch] Sample Test',
                alwaysMatch: {
                    // Enable this if you encounter unexpected SSL certificate errors in Firefox
                    // acceptInsecureCerts: true,
                    'moz:firefoxOptions': {
                        args: [
                            // '-headless',
                            // '-verbose'
                        ],
                    }
                }
            }
        }
    }
};

// Code to copy seleniumhost/port into test settings
for(var i in nightwatch_config.test_settings){
    var config = nightwatch_config.test_settings[i];
    config['selenium_host'] = nightwatch_config.selenium.host;
    config['selenium_port'] = nightwatch_config.selenium.port;
}

module.exports = nightwatch_config;

I can certainly post more info if needed, but will start here in case this is a common setup error, as I am unfamiliar with front-end automation.

1 Answer