离线机器上的量角器

Tal*_*ili 5 selenium protractor angular-cli

  • Angular 4 cli 项目我们有带有私有 npm 存储库的私有网络。(没有连接到互联网)。所以在下载所有模块后,我想运行 e2e 测试。

量角器使用 webdriver-manager 下载最新的 chrome 驱动程序。但他无法下载驱动程序,所以我收到此错误:

etaddrinfo ENOTFOUND chromedriver.storage.googleapis.com chromedriver.storage.googleapis.com:443
Run Code Online (Sandbox Code Playgroud)

我尝试手动下载驱动程序,并在 protactor-config 中:

{
  chromeDriver: "../../chromedriver.exe", // I also tried with "./chromedriver_2.30.exe"
Run Code Online (Sandbox Code Playgroud)

.... }

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

但是我一直收到这个错误,我如何在没有互联网连接的情况下处理这个错误?

顺便说一句,需要考虑的是,我们在 Windows 上开发,但是我们的 ci/cd 服务器(linux)如何获得适合 linux 的驱动程序?

Ati*_*eed 4

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

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