我在运行WebdriverIO测试时遇到问题,我认为这与我在公司代理后面运行的处理方式有关。过去一切正常,但突然间停下来,经过几个小时尝试各种事情后,我的构想耗尽了。
我的代理详细信息以setHeight
和http_proxy
的名称保存为Windows系统变量。我没有改变这些。我用于变量的格式如下:https_proxy
。
通过外部连接连接到互联网时,我也会收到错误消息,所以我不是100%导致此问题的代理。
我已经尝试更新所有软件包,因此我的软件包文件现在看起来像这样:
http://myusername:mypassword@myproxyaddress:8080
我的wdio.conf.js文件在这里(注释从实际文件中删除):
{
"name": "name",
"version": "1.0.0",
"description": "UI Tests",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/wdio ./wdio.conf.js"
},
"author": "Matt Thomas",
"license": "ISC",
"devDependencies": {
"@wdio/dot-reporter": "^5.18.6",
"@wdio/local-runner": "^5.18.6",
"@wdio/mocha-framework": "^5.18.6",
"@wdio/selenium-standalone-service": "^5.16.10",
"@wdio/spec-reporter": "^5.18.6",
"@wdio/sync": "^5.18.6",
"chai": "^4.2.0",
"chai-webdriverio": "^1.0.0",
"chromedriver": "^79.0.3",
"local-runner": "^0.1.1-alpha",
"wdio-chromedriver-service": "^5.0.2",
"webdriver": "^5.18.6"
},
"dependencies": {
"@wdio/cli": "^5.18.6"
}
}
运行测试的终端:
exports.config = {
specs: [
'./test/**/*.js'
],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [{
maxInstances: 5,
browserName: 'chrome'
}],
logLevel: 'trace',
bail: 0,
baseUrl: 'https://apps-dev.bhp.com/moc/',
waitforTimeout: 15000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: ['chromedriver','selenium-standalone'],
framework: 'mocha',
reporters: ['spec','dot'],
mochaOpts: {
ui: 'bdd',
timeout: 120000
},
beforeTest: function (test, context) {
const chai = require('chai')
const chaiWebdriver = require('chai-webdriverio').default
chai.use(chaiWebdriver(browser))
global.assert = chai.assert
global.should = chai.should
global.expect = chai.expect
},
}
答案 0 :(得分:0)
由于您尝试使用Selenium独立服务且位于代理后面,因此应在配置文件中包括以下设置。这对我有用。我包括了一些您可以参考的文件。
skipSeleniumInstall: false,
seleniumInstallArgs: {
requestOpts: {
strictSSL: false,
timeout: 10000,
proxy: proxyurl,
},
},
https://webdriver.io/docs/selenium-standalone-service.html#skipseleniuminstall
WebdriverIO: How to fix error "unknown error: cannot get automation extension"?
干杯!