Currently this steps takes ~2 minutes and must be run on every build that will run browser tests. :(
I'm not sure what it takes to get software added to GitHub's runners but this is essential. Please add them. 😣
The Windows environments seem to have all Selenium WebDrivers installed which is a huge convenience. The Ubuntu environments already have Firefox and Chrome Browsers installed at specific versions so having to pick out the right WebDriver versions just for running in GitHub's runners and caching them to avoid downloading on every run is tedious.
My script to install right version of chromedriver, tested on ubuntu 18.04
- name: Install ChromeDriver
run: |
CHROME_VERSION=$(google-chrome --version | cut -f 3 -d ' ' | cut -d '.' -f 1) \
&& CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
&& cd /tmp \
&& unzip chromedriver_linux64.zip \
&& rm -rf chromedriver_linux64.zip \
&& sudo mv chromedriver /usr/local/bin/chromedriver \
&& sudo chmod +x /usr/local/bin/chromedriver \
&& chromedriver --version
It also takes less time than apt-get install chromium-chromedriver
.
lbraun, synion, hmatringe, bharadwaj-pendyala, iamareebjamal, the-one-Ayush, stemadocafe, demir, ImSejin, and berk76 reacted with thumbs up emoji
synion, kevinccbsg, and bharadwaj-pendyala reacted with hooray emoji
All reactions
I am currently looking to use GitHub Actions to test a WebDriver binding and need it for C.I.
Currently, my plan is to include the Docker image selenium/standalone-chrome and run a the container for testing and documentation purposes.
@alepauly
This isn't working as I would have expected
My expectation was that the environment variable CHROMEWEBDRIVER
would point to the folder that contains Chrome Driver and not the actual executable file
On Windows the environment variable CHROMEWEBDRIVER
points to C:\SeleniumWebDrivers\ChromeDriver
i.e. a folder
and the documentation indicates it should be a folder https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
Thank you for adding ChromeDriver on Ubuntu 18. However, the ChromeDriver provided does not match the pre-installed Google Chrome version. These two need to match in order for ChromeDriver to use the correct interfaces. Otherwise certain functions will fail.
ChromeDriver Version: 79.0.3945.36
Google Chrome Version: 79.0.3945.130
I understand that the latest ChromeDriver version on the official website hasn't been released yet, but in that case, until it is released, it's worth not updating Google Chrome. Otherwise ChromeDriver is useless and tests/automations will start failing.
Hello @jahed, thank you for your response, as described in documentation: Each version of ChromeDriver supports Chrome with matching major, minor, and build version numbers. For example, ChromeDriver 73.0.3683.20 supports all Chrome versions that start with 73.0.3683. It is not required to have equal patch version.
Thanks, I fell for a red herring. I assumed Fedora's approach (the distro I use) was standard since their build numbers for Chromium and ChromeDriver match on every new release, but that isn't the case. Probably just a result of them building them in the same process.
I'll continue testing other pieces to find the culprit. Really difficult when something suddenly stops working on GitHub's runners but works everywhere else. It's a bit of a black blox. 😓
It would help if this software list page was kept up-to-date and versioned like a wiki so we'd know when things change (e.g. Google Chrome is still on 78 and there's no ChromeDriver under Ubuntu environments).
Thanks again.
Update: I literally changed nothing and it's working now. Putting it down to something in GitHub's runner environment, whatever it is.
@jahed - sorry for the out of date docs, we've been working on improving that. For now the best source is to look at either at the readme files in master which are updated when the rollout of an image is complete, or the linked readmes through the badges in our repo readme which will link to the version currently rolling out. It takes about a week for a new image to make it through to all customers.
Getting the following error when running my system specs. I think it's somehow related to this. Any suggestions would be welcomed.
Selenium::WebDriver::Error::UnknownError:
unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
* Create django.yml
Source: https://github.com/actions/starter-workflows/blob/master/ci/django.yml
* Add SECRET_KEY to DJANGO_DEBUG_FALSE conditional.
* Add functional tests skeleton.
* Update django.yml
Add functional tests to Run Tests step.
* Update django.yml
Workaround to install geckodriver
* Update django.yml
Remove functional tests until I can add geckodriver or switch to another supported webdriver actions/runner-images#9
* Attempt to reimplement functional_tests in actions via chrome
* Undo change to GH action
* Update django.yml (#10)
* Update django.yml
* Update django.yml
Per https://github.com/ianwalter/bff-webdriver/blob/master/.github/workflows/ci.yml#L16 from https://ianwalter.dev/running-selenium-webdriver-tests-using-github-actions/
* Update tests.py
* Update tests.py
* Update tests.py
* Update django.yml
Remove container strategy
* Update django.yml
* Update django.yml
* Add app: pyladies. Initial unit tests skeleton.
* Test basic view returns minimal HTML
* Refactor home page view to use template.
* Configure functional_tests for django runner
* Extend base.html
* Add user profile
* Temporarily ignore migrations
* Add migrations to git
* Add .DS_Store to .gitignore
* Register user profiles to admin site.
* Initial check-in functionality via admin interface
* Add event list to landing page
* Move check-in link to event summary.
* Update README.md (#12)
Add CI passing badge to develop branch README.md
Hey @dmitry-shibanov I am also getting @lorman's error:
Selenium::WebDriver::Error::UnknownError:
unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I've tried manually installing ChromeDriver but that didn't do anything. I'm using ubuntu-latest
for the image. Is there a configuration I have to explicitly set somewhere?
Edit: You can ignore this comment. After about 20 hair-pulling hours I fixed a multitude of syntax errors in my code.
I am getting this issue. I have a Rails app using Capybara to run integration tests, and I hit this error during execution on ubuntu-latest
:
Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Selenium::WebDriver::Error::UnknownError)
Please advise with anything I can try to get this working.
"DevToolsActivePort file doesn't exist" error when running Capybara tests using headless Chrome
It had to be manually installed before, now it seems to be present.
See actions/runner-images#9
Fixes #3812
It had to be manually installed before, now it seems to be present.
See actions/runner-images#9
Fixes #3812
Hey @dmitry-shibanov I am also getting @lorman's error:
Selenium::WebDriver::Error::UnknownError:
unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I've tried manually installing ChromeDriver but that didn't do anything. I'm using ubuntu-latest
for the image. Is there a configuration I have to explicitly set somewhere?
Edit: You can ignore this comment. After about 20 hair-pulling hours I fixed a multitude of syntax errors in my code.
I ran into this also. The issue was I needed to ensure I was running Chrome in HEADLESS mode.
This is my Capybara configuration file (spec/support/capybara.rb):
Capybara.register_driver :chrome_headless do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
'goog:chromeOptions': {
args: %w[ no-sandbox headless disable-gpu --window-size=1920,1080]
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
#Ensure Log directory exists
%x(mkdir -p tmp/selenium_logs)
Capybara.register_driver :chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
'goog:chromeOptions': { args: %w[ start-maximized ] }
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: capabilities,
service: ::Selenium::WebDriver::Service.chrome(
args: {
log_path: "./tmp/selenium_logs/selenium-#{Time.now.to_i}.log",
verbose: true
Capybara.javascript_driver = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER', :chrome).to_sym
#must allow this URL if Chromedriver needs to download a binary
WebMock.disable_net_connect!(allow: 'chromedriver.storage.googleapis.com', allow_localhost: true)
Capybara.server = :webrick
So in my case, setting CAPYBARA_JAVASCRIPT_DRIVER=chrome_headless
in my step that runs RSpec did the trick.
Like this:
- name: Run tests
run: bin/rspec
env:
RAILS_ENV: test
RACK_ENV: test
PGHOST: localhost
POSTGRES_USER: myapp
POSTGRES_PASSWORD: myapp_test
POSTGRES_DB: myapp_test
CAPYBARA_JAVASCRIPT_DRIVER: chrome_headless