Reputation: 1546
will appreciate any help!
webdriver-manager clean
webdriver-manager update --ie32 --proxy http://my-proxy:8080 --ignore_ssl
my protractor.conf file is as follows:
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome',
'proxyType': 'manual',
'httpProxy': 'http://my-proxy:8080'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
Tried to ran tests first by: ng e2e
second by:
ng e2e --config ./protractor.conf.js --specs ./e2e\app.e2e-spec.ts
And still getting this proxy error:
events.js:136
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND chromedriver.storage.googleapis.com chromedriver.storage.googleapis.com:443
at errnoException (dns.js:55:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:26)
Upvotes: 4
Views: 3284
Reputation: 56
After we add the 3 environment variables, it almost works (thanks a lot for providing that solution) but if the proxy does not trust the site: https://chromedriver.storage.googleapis.com/
then we get:
Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1058:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket._finishInit (_tls_wrap.js:636:8)
so, we still need to figure out a way to pass "ignoreSSL = true" to "ng e2e" because ng command should pass it down as "webdriver-manager update --ignore_ssl"
1.(Only working solution currently) One way is to modify the file protractor\node_modules\webdriver-manager\built\lib\cmds\opts.js by updating the value of opts[exports.IGNORE_SSL]
opts[exports.IGNORE_SSL] = new cli_1.Option(exports.IGNORE_SSL, 'Ignore SSL certificates', 'boolean', true);
May be we try another environment variable or some how pass this value via angular.json file but I could not figure that out yet
Some how pass the certificate used by the proxy to trust the external site when the protractor runs the following:
curl -o.\node_modules\protractor\node_modules\webdriver-manager\selenium\chrome-response.xml https://chromedriver.storage.googleapis.com/
Upvotes: 0
Reputation: 13722
ng e2e
will execute webdriver-manager start/update
in background, and webdriver-manager start
will access "chromedriver.storage.googleapis.com" to query latest webdriver binary, your error comes from here.
Because ng e2e
can't accept proxy from cli or pre-configured file, the only way you can set proxy for webdriver-manager start/update
triggered by ng e2e
is by Environment Variable
.
Add below 3 Environment Variables:
HTTP_PROXY = http://my-proxy:port
HTTPS_PROXY = http://my-proxy:port
NO_PROXY = localhost,127.0.0.1, .yourcompany.com
Try ng e2e
in new cmd window (don't try in old cmd window)
FYI, once you add the 3 Environment Variables, you no need to pass --proxy
in cli when execute webdriver-manager start/update
.
Upvotes: 5