9

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

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

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

如果你知道什么,请帮忙。

4

2 回答 2

28

大多数浏览器测试框架都会包含 Selenium。如果您需要运行一个独立的 Selenium 服务器,您可以将以下内容添加到您的 repo 根目录中的 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: true”的 4 个空格缩进。这告诉 YAML 将其background视为命令的修饰符。

更多文档在这里:

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

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

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

于 2014-02-25T23:38:43.030 回答
5

安装 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
于 2016-09-19T08:17:46.630 回答