trees_are_great
trees_are_great

Reputation: 3911

how to set https proxy for selenium's webdriver?

I am trying to use protractor for automated javascript testing. This means following these instructions: http://www.ng-newsletter.com/posts/practical-protractor.html

npm install -g protractor

completes fine. However:

webdriver-manager update

does not get round the proxy I have at work. Apparently, you can now set the proxy in a configuration, but I can not follow how to do this: https://github.com/angular/protractor/pull/966 Basically, I need to set 'env.HTTPS_PROXY', but I can't see where to do this? I can see that I could probably edit the webdriver-manager file to fix this, but that seems wrong.

Note: I have tried installing this files (from webdriver-manager update) manually and copying them into the expected locations, but the jar file becomes corrupt.

Upvotes: 11

Views: 20336

Answers (3)

Cassian
Cassian

Reputation: 3738

In cmd

set PROXY=http://username:password@proxyserver:port
set HTTP_PROXY=%PROXY%
set HTTPS_PROXY=%PROXY% 
webdriver-manager update

Or go to file .npmrc usually is here C:\Users\username.npmrc ( if not, search it with command npm config ls -l | grep config) and set the proxy variables manually by typing in it

proxy=http://username:password@proxyserver:port
https-proxy=http://username:password@proxyserver:port

A third way is to make two system environment variables HTTP_PROXY and HTTPS_PROXY with value http://username:password@proxyserver:port

Upvotes: 17

deepak
deepak

Reputation: 61

webdriver-manager update 

For me, it worked when I switched network, from proxy to without proxy and downloaded folders from the displayed URL and pasted in specified location

\testApp>webdriver-manager update [16:20:02] I/update - chromedriver: file exists C:\Program Files\nodejs\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.41.zip [16:20:02] I/update - chromedriver: unzipping chromedriver_2.41.zip [16:20:02] I/update - chromedriver: chromedriver_2.41.exe up to date [16:20:03] I/update - selenium standalone: file exists C:\Program Files\nodejs\node_modules\protractor\node_modules\webdriver-manager\selenium\selenium-server-standalone-3.14.0.jar [16:20:03] I/update - selenium standalone: selenium-server-standalone-3.14.0.jar up to date [16:20:08] I/downloader - curl -oC:\Program Files\nodejs\node_modules\protractor\node_modules\webdriver-manager\selenium/geckodriver-v0.21.0.zip https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-win64.zip

Upvotes: 0

trees_are_great
trees_are_great

Reputation: 3911

I've just discovered that it is now configured to support --proxy="<proxy>" as an argument, so problem solved.

I also needed to use --ignore_ssl for this

Upvotes: 18

Related Questions