1

我正在尝试针对在 BrowserStack 中的 iPhone 上运行的 Safari 进行测试。使用 nightwatch 测试框架。当我从我的 IDE(IntelliJ)启动运行程序时,我看到了这个错误:

/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;

如果需要,我当然可以发布更多信息,但如果这是一个常见的设置错误,我会从这里开始,因为我不熟悉前端自动化。

4

1 回答 1

1

看来您在配置中的某处添加了 W3C 协议,您可以分享此处设置的功能吗?您可以尝试从此处运行示例测试:https ://github.com/browserstack/nightwatch-browserstack

于 2020-04-28T21:44:16.897 回答