Dockerfile for selenium with chromedriver and chromium-browser
430
This repository contains a Dockerfile for running the Chromium Browser along with chromedriver as a Selenium remote service. This allows an app running in another container to run browser tests in a container.
Part of this setup is taken from RobCherry/docker-selenium.
Run either docker pull sh4rk/selenium-chrome or build the image yourself with docker build -t sh4rk/selenium-chrome ..
See docker-compose.yml for an example on how to use this image.
You'll have to configure your test runner to access the remote Selenium instance. If you're using capybara for Ruby on Rails, you can put the following into your rails_helper.rb:
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app,
browser: :remote,
desired_capabilities: :chrome,
url: "http://#{ENV['CHROME_HOSTNAME']}:4444/wd/hub"
)
end
Capybara.server_host = '0.0.0.0'
Capybara.server_port = Capybara::Server.new(Rails.application).send(:find_available_port, Capybara.server_host)
Capybara.app_host = "http://#{`ip address show eth0 | grep inet | head -n1 | awk '{print $2}' | cut -d/ -f 1`.strip}:#{Capybara.server_port}"
Capybara.javascript_driver = :chrome
git checkout -b my-new-featuregit commit -am 'Add some feature'git push origin my-new-featureThis project is licensed under the MIT License. See LICENSE for details.
Content type
Image
Digest
Size
351.5 MB
Last updated
over 8 years ago
docker pull sh4rk/selenium-chrome