Chromedriver on Travis-CI

前端 未结 3 1749
孤街浪徒
孤街浪徒 2021-02-01 18:53

I am having trouble getting chromedriver on Travis-CI working for my project knockout-secure-binding. I am trying to use WebdriverJS to automate testing with Chrome, at the leas

3条回答
  •  庸人自扰
    2021-02-01 19:13

    I think Travis does support chrome driver, if you add these in your travis.yml, extract the right chromedriver and unzip it to a known location, so that you can trace it later.

    before_script:
      - wget http://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip
      - unzip chromedriver_linux64.zip -d /home/travis/virtualenv/python2.7.9/
      - export CHROME_BIN=chromium-browser
      - "export DISPLAY=:99.0"
      - "sh -e /etc/init.d/xvfb start"
      - sleep 3 
    

    Plus when you call selenium or any testing automation library, you would need to add this the code here is in Python but this can be done in Java and Ruby as well.

    options = webdriver.ChromeOptions()
    options.binary_location = '/usr/bin/chromium-browser'
    #All the arguments added for chromium to work on selenium
    options.add_argument("--no-sandbox") #This make Chromium reachable
    options.add_argument("--no-default-browser-check") #Overrides default choices
    options.add_argument("--no-first-run")
    options.add_argument("--disable-default-apps") 
    driver = webdriver.Chrome('/home/travis/virtualenv/python2.7.9   /chromedriver',chrome_options=options)
    

提交回复
热议问题