I'm having problems running my WebdriverIO tests and I think it's to do with how I'm handling running behind a corporate proxy. Things used to work fine but suddenly they have stopped and after a few hours trying various things I've run out of ideas.
My proxy details are saved as windows system variables in the name of http_proxy
and https_proxy
. I haven't changed these. The format I'm using for a variable is like this - http://myusername:mypassword@myproxyaddress:8080
.
I also get errors when connecting to the internet through an external connection so I'm not 100% its the proxy causing this.
I've tried update all my packages so my package file now looks like this:
{
"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"
}
}
My wdio.conf.js file is here(comments stripped out from actual file):
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
},
}
And my terminal when i run the test:
PS C:\Test Automation\Projects\WebdriveriO\GlobalMoC> npm test -- --spec ./test/login.test.js
> globalmoc@1.0.0 test C:\Test Automation\Projects\WebdriveriO\GlobalMoC
> wdio ./wdio.conf.js "--spec" "./test/login.test.js"
Execution of 1 spec files started at 2020-02-14T00:54:12.038Z
2020-02-14T00:54:12.042Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "chromedriver"
2020-02-14T00:54:12.131Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "selenium-standalone"
2020-02-14T00:54:12.204Z INFO @wdio/cli:launcher: Run onPrepare hook
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 4444
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
2020-02-14T00:54:12.793Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: Could not download https://selenium-release.storage.googleapis.com/3.14/IEDriverServer_Win32_3.14.0.zip: Error: unable to get local issuer certificate
at Request.<anonymous> (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\selenium-standalone\lib\install.js:387:12)
at Object.onceWrapper (events.js:286:20)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at Request.onRequestError (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:881:8)
at ClientRequest.emit (events.js:198:13)
at ClientRequest.EventEmitter.emit (domain.js:448:20)
at TLSSocket.socketErrorListener (_http_client.js:392:9)
at TLSSocket.emit (events.js:198:13)
at TLSSocket.EventEmitter.emit (domain.js:448:20)
Continue...
2020-02-14T00:54:12.831Z INFO @wdio/local-runner: Start worker 0-0 with arg: ./wdio.conf.js,--spec,./test/login.test.js
[0-0] 2020-02-14T00:54:14.120Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - C:\Test Automation\Projects\WebdriveriO\GlobalMoC\test\login.test.js
[0-0] 2020-02-14T00:54:14.473Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-02-14T00:54:14.477Z INFO webdriverio: Initiate new session using the webdriver protocol
2020-02-14T00:54:14.481Z INFO webdriver: [POST] http://127.0.0.1:4444/session
2020-02-14T00:54:14.482Z INFO webdriver: DATA { capabilities:
{ alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' } }
[0-0] 2020-02-14T00:54:14.629Z DEBUG webdriver: request failed due to missing body
[0-0] 2020-02-14T00:54:14.630Z WARN webdriver: Request failed due to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
[0-0] 2020-02-14T00:54:14.630Z INFO webdriver: Retrying 1/3
2020-02-14T00:54:14.630Z INFO webdriver: [POST] http://127.0.0.1:4444/session
2020-02-14T00:54:14.630Z INFO webdriver: DATA { capabilities:
{ alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' } }
2020-02-14T00:54:14.661Z DEBUG webdriver: request failed due to missing body
2020-02-14T00:54:14.661Z INFO webdriver: Retrying 2/3
2020-02-14T00:54:14.661Z INFO webdriver: [POST] http://127.0.0.1:4444/session
2020-02-14T00:54:14.661Z INFO webdriver: DATA { capabilities:
{ alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' } }
[0-0] 2020-02-14T00:54:14.661Z WARN webdriver: Request failed due to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
2020-02-14T00:54:14.691Z WARN webdriver: Request failed due to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
2020-02-14T00:54:14.722Z ERROR webdriver: Request failed due to Error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
at getErrorFromResponseBody (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\webdriver\build\utils.js:117:12)
at Request._callback (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\webdriver\build\request.js:111:64)
at Request.self.callback (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:185:22)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at Request.<anonymous> (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:1161:10)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at IncomingMessage.<anonymous> (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:286:20)
2020-02-14T00:54:14.723Z ERROR webdriver: Error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
at getErrorFromResponseBody (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\webdriver\build\utils.js:117:12)
at Request._callback (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\webdriver\build\request.js:111:64)
at Request.self.callback (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:185:22)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at Request.<anonymous> (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:1161:10)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at IncomingMessage.<anonymous> (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:286:20)
2020-02-14T00:54:14.724Z ERROR @wdio/runner: Error: Failed to create session.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
at startWebDriverSession (C:\Test Automation\Projects\WebdriveriO\GlobalMoC\node_modules\webdriver\build\utils.js:45:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-0] Error: Failed to create session.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>406 - Client browser does not accept the MIME type of the requested page.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>406 - Client browser does not accept the MIME type of the requested page.</h2>
<h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3>
</fieldset></div>
</div>
</body>
</html>
[0-0] 2020-02-14T00:54:14.691Z DEBUG webdriver: request failed due to missing body
2020-02-14T00:54:14.691Z INFO webdriver: Retrying 3/3
2020-02-14T00:54:14.691Z INFO webdriver: [POST] http://127.0.0.1:4444/session
2020-02-14T00:54:14.692Z INFO webdriver: DATA { capabilities:
{ alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' } }
2020-02-14T00:54:14.722Z DEBUG webdriver: request failed due to missing body
2020-02-14T00:54:15.284Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in chrome - C:\Test Automation\Projects\WebdriveriO\GlobalMoC\test\login.test.js
2020-02-14T00:54:15.302Z INFO @wdio/cli:launcher: Run onComplete hook
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:03
2020-02-14T00:54:15.306Z INFO @wdio/local-runner: Shutting down spawned worker
2020-02-14T00:54:15.569Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2020-02-14T00:54:15.578Z INFO @wdio/local-runner: shutting down
npm ERR! Test failed. See above for more details.