使用CircleCI进行硒测试

Mic*_*lko 9 selenium circleci huxley

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

但为此我需要运行selenium服务器.

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

如果你有所了解,请帮忙.

Dan*_*fel 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
Run Code Online (Sandbox Code Playgroud)

这将下载最新的独立Selenium jar并在后台运行它.注意第二个命令末尾的冒号和"background:true"的4空格缩进.这告诉YAML将其background视为命令的修饰符.

更多文档:

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

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

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

  • 到目前为止,CirceCI仍然是最好的CI! (2认同)

Ale*_*nyk 5

安装完整的硒,镀铬和镀铬堆:

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
Run Code Online (Sandbox Code Playgroud)