我正在使用 CircleCI,我想运行 Huxley 测试。

但为此我需要运行硒服务器。

我试图运行 selenium 服务器独立 jar。那不是解决方案。

如果您知道的话请帮忙。

有帮助吗?

解决方案

大多数浏览器测试框架都会为您提供 Selenium。如果您需要运行独立的 Selenium 服务器,您可以将以下内容添加到存储库根目录中的 Circle.yml 中:

dependencies:
   post:
      - wget https://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar
      - java -jar selenium-server-standalone-2.44.0.jar:
            background: true

这将下载最新的独立 Selenium jar 并在后台运行它。请注意第二个命令末尾的冒号以及“background:”的 4 个空格缩进:真的”。这告诉 YAML 来处理 background 作为命令的修饰符。

更多文档在这里:

https://circleci.com/docs/background-process

https://circleci.com/docs/installing-custom-software

笔记: 如果您在此答案中更新 JAR 链接,请确保它是 HTTPS。通过不安全的 HTTP 下载某些内容并在不检查校验和的情况下运行它通常被认为是危险的,因为中间人攻击可能导致 JAR 替换/篡改。

其他提示

安装完整堆栈的Selenium,Chromedriver和Chrome:

dependencies:
  pre:

  # Install Selenium.
  - curl http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar > selenium-server-standalone.jar
  - curl http://chromedriver.storage.googleapis.com/2.23/chromedriver_linux64.zip | gzip -dc > chromedriver
  - chmod +x chromedriver
  - 'java -jar selenium-server-standalone.jar -trustAllSSLCertificates -Dwebdriver.chrome.driver=chromedriver':
        background: true
  # Update Google Chrome.
  - google-chrome --version
  - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
  - sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb stable main" >> /etc/apt/sources.list.d/google.list'
  - sudo apt-get update
  - sudo apt-get --only-upgrade install google-chrome-stable
  - google-chrome --version
.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top