我目前正在尝试同时设置Webdriver和Selenium,以便通过Docker运行自动化测试,但遇到了问题。每次尝试运行测试时,都会出现以下错误ERROR wdio-runner: Error: connect ECONNREFUSED 127.0.0.1:4444
我正在使用来自docker的selenium / standalone-chrome,可以看到服务器已正确配置并以127.0.0.1:4444的速度运行。
但是,当我尝试运行webdriver时,似乎遇到了上述问题。我认为该问题一定是我的webdriver配置中存在的问题,但是按照文档操作,我看不到有什么问题...
const chai = require('chai');
const chaiWebdriver = require('chai-webdriverio').default;
const debug = process.env.DEBUG;
exports.config = {
runner: 'local',
host: '127.0.0.1',
port: 4444,
path: '/wd/hub',
specs: ['specs/**/*.js'],
suites: {
smoke: ['specs/smoke-spec.js']
},
maxInstances: 10,
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {}
},
sync: true,
logLevel: 'error',
coloredLogs: true,
deprecationWarnings: false,
bail: 0,
debug,
execArgv: debug ? ['--inspect'] : [],
screenshotOnReject: true,
screenshotPath: './error-screenshots',
baseUrl: https://localhost:443,
waitforTimeout: 30000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
seleniumLogs: './selenium-logs',
framework: 'mocha',
reporters: [
[
'allure',
{
outputDir: 'test-output',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false
}
],
['spec', {}]
],
mochaOpts: {
ui: 'bdd',
timeout: 400000,
compilers: ['js:babel-register']
},
before() {
chai.use(chaiWebdriver(browser));
global.expect = chai.expect;
},
afterTest: test => {
if (!test.passed) {
browser.takeScreenshot();
}
}
};