Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor on offline machine

  • Angular 4 cli project We have private network with private npm repository. (There is no connection to the internet). so after all modules are downloaded I want to run e2e tests.

Protractor use webdriver-manager to download the latest chrome driver. but he can't download the driver so I get this error :

etaddrinfo ENOTFOUND chromedriver.storage.googleapis.com chromedriver.storage.googleapis.com:443

I tried to download the driver manually, and inside the protactor-config :

{
  chromeDriver: "../../chromedriver.exe", // I also tried with "./chromedriver_2.30.exe"

.... }

(I don't know if the chromedriver is relative path to the protractor.config or to the webdriver-manager module inside protractor)

But I keep getting this error, how can I treat this error without an internet connection at all?

btw, something to consider, we develop on windows, but how can our ci/cd server (linux) will get a driver suitable for linux??

like image 437
Tal Gvili Avatar asked Jun 20 '17 19:06

Tal Gvili


2 Answers

I had a similar issue. After trying different approaches like manually copying the driver or changing the protractor module, I found that the best workaround is to install a local Web server and provide the required driver for download through that local server. This solution worked and is also useful to provide other files (e.g. files that are directly downloaded during "npm install"). Steps are listed below.

  • Install Apache on the offline system or any other system accessible to that offline system.
  • On an online system, download the driver from (https://chromedriver.storage.googleapis.com/ - the site that the update command tries to access). Accessing this site in the browser displays a file (download.xml) that lists different versions of the web driver for different platforms. You can download the required version by appending the "Key" shown in that file to the end of the URL e.g. (https://chromedriver.storage.googleapis.com/2.33/chromedriver_win32.zip) to download version 2.33 of the chrome driver for windows. I tried newer versions but found that 2.33 worked on Win 10 (64 bit)/Chrome 61.
  • Manually copy the downloaded zip file to the offline system in the Apache htdocs folder using the same path as in the key e.g. (c:\\htdocs\2.33\chromedriver_win32.zip)
  • Make a download.xml file similar to the one on the actual site (https://chromedriver.storage.googleapis.com) but only list one entry for the driver version that you need.
  • Modify your Apache config file (conf\httpd.conf) to make download.xml as DirectoryIndex file
  • Run Apache (bin\httpd.exe)
  • Change your windows hosts file to add an entry to map (chromedriver.storage.googleapis.com) to the IP of the system where Apache is running.
  • Run "ng e2e". "webdriver-manager update" will download this local driver and tests will continue.
like image 139
Atif Majeed Avatar answered Nov 08 '22 02:11

Atif Majeed


I had a similar issue. Found this answer with googling and I tried it. Seems to work.

With recent changes in protractor you can use:

ng e2e --webdriver-update=false
like image 4
Patrick Jezek Avatar answered Nov 08 '22 01:11

Patrick Jezek