离线机器上的量角器 [英] Protractor on offline machine

查看:126
本文介绍了离线机器上的量角器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • Angular 4 CLI项目 我们有带有私有npm存储库的私有网络. (没有连接到互联网). 因此,在下载完所有模块后,我要运行e2e测试.
  • 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.

量角器使用webdriver-manager下载最新的chrome驱动程序. 但是他无法下载驱动程序,所以我得到了这个错误:

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

我尝试在protactor-config内部手动下载驱动程序:

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

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

.... }

.... }

(我不知道chromedriver是protractor.config还是protractor内部的webdriver-manager模块的相对路径)

(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?

需要考虑的一点是,我们在Windows上进行开发,但是我们的ci/cd服务器(Linux)如何获得适合Linux的驱动程序?

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

推荐答案

我遇到了类似的问题.在尝试了诸如手动复制驱动程序或更改量角器模块之类的不同方法之后,我发现最好的解决方法是安装本地Web服务器,并提供所需的驱动程序以通过该本地服务器进行下载.该解决方案有效,并且对于提供其他文件(例如,在"npm安装"期间直接下载的文件)也很有用.步骤如下.

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.

  • 在离线系统或该离线系统可访问的任何其他系统上安装Apache.
  • 在在线系统上,从( https://chromedriver.storage.googleapis.com/-更新命令尝试访问的网站).在浏览器中访问此站点将显示一个文件(download.xml),其中列出了适用于不同平台的Web驱动程序的不同版本.您可以通过将文件中显示的密钥"附加到网址末尾来下载所需的版本,例如( https://chromedriver.storage.googleapis.com/2.33/chromedriver_win32.zip)下载适用于Windows的chrome驱动程序的2.33版.我尝试了较新的版本,但发现2.33可以在Win 10(64位)/Chrome 61上运行.
  • 使用与密钥(例如)中相同的路径,将下载的zip文件手动复制到Apache htdocs文件夹中的离线系统. (c:\\ htdocs \ 2.33 \ chromedriver_win32.zip)
  • 制作一个与实际网站上的文件类似的download.xml文件( https://chromedriver.storage. googleapis.com ),但仅列出所需驱动程序版本的一项.
  • 修改您的Apache配置文件(conf \ httpd.conf)以将download.xml制成DirectoryIndex文件
  • 运行Apache(bin \ httpd.exe)
  • 更改Windows主机文件以添加一个条目,以将(chromedriver.storage.googleapis.com)映射到运行Apache的系统的IP.
  • 运行"ng e2e". "webdriver-manager更新"将下载此本地驱动程序,并且测试将继续.
  • 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.

这篇关于离线机器上的量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆