我创建了如下所示的 nightwatch.json 文件(具有用户名和 access_key 属性):
"test_settings": {
"default": {
"launch_url": "http://localhost",
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"cli_args": {
"webdriver.firefox.profile": "testprofile"
},
"screenshots": {
"enabled": false,
"path": "screenshots/"
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
},
"username": "examplelogin",
"access_key": "password"
}
但基本身份验证不起作用,我在运行测试后获得登录窗口以填写我的密码并登录。我查看了 fiddler 中的数据包,没有授权 header 存在。知道我做错了什么吗?
守夜人 v0.9.6
最佳答案
来自:https://groups.google.com/d/msg/nightwatchjs/n-B4HnnzYg8/rmaipXiTsuwJ
Replying to my own post before - please don't confuse the username and access_key vars as 'basic auth' ones. They are selenium based authenticators which can optionally be used for authenticating against cloud solutions. Best solution for basic auth is the good old URL way. Try: ``` browser.url('https://' + userName + ':' + password + '@' + yourUrl)
关于selenium - 守夜人 : Basic auth with access_key not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39096176/