如何在守夜人中使用 Safari Technology Preview?

How to use Safari Technology Preview in nightwatch?

我没有找到任何关于如何使用 Safari 技术预览正确设置守夜人配置的信息。

我试过这样的事情:

module.exports = {
    "src_folders": [
        "suites"
    ],
    "output_folder": "reports",
    "custom_commands_path": "commands",
    "page_objects_path": "pageObjects",
    "globals_path": "globals.js",
    "selenium": {
        "start_process": true,
        "server_path": seleniumServer.path,
        "host": "127.0.0.1",
        "port": 4444,
        "log_path": "logs",
        "cli_args": {
            "webdriver.chrome.driver": chromedriver.path,
            "webdriver.firefox.driver": '/usr/bin/geckodriver',
            "webdriver.safari.driver": '/usr/bin/safaridriver'
        }
    },
    "test_settings": {
        "default": {
            "launch_url": "http://google.com",
            "screenshots": {
                "enabled": true,
                "on_failure" : true,
                "on_error" : true
            },
            "globals": {
                "waitForConditionTimeout": 5000,
                "retryAssertionTimeout": 5000
            },
            "desiredCapabilities": {
                "browserName": "safari",
                "browserVersion": "12",
                "technologyPreview": true
            },
            "skip_testcases_on_fail": false,
            "end_session_on_fail": false
        }
    }
};

但是执行后我得到这个错误:

{ value: 
   { message: 'Could not create a session: A browser with name \'safari\' version \'12\' could not be found on the system.\nBuild info: version: \'3.13.0\', revision: \'2f0d292\', time: \'2018-06-25T15:32:19.891Z\'\nSystem info: host: \'Boostas-MacBook-Pro-5.local\', ip: \'fe80:0:0:0:100a:70f9:d6d7:cbfc%en0\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.13.6\', java.version: \'10.0.1\'\nDriver info: driver.version: unknown\nremote stacktrace: ',
     error: 'session not created' },
  status: 33 }

注意: 如果我将 technologyPreview 设置为 false,则在 Safari 浏览器中测试将是 运行。

希望大家帮帮我!

这两个选项在我的案例中有效 nightwatch.json 以启动 Safari 技术预览:

  "desiredCapabilities": {
    "browserName": "safari",
    "safari.options": {"technologyPreview": true},
  }

有用的参考:https://macops.ca/using-safari-technology-preview-with-selenium-webdriver/

希望对您有所帮助!