• This repository has been archived on 01/Apr/2019
  • Stars
    star
    313
  • Rank 133,714 (Top 3 %)
  • Language
    HTML
  • License
    MIT License
  • Created almost 13 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deprecated in favor of the `webdrivers` gem.

NOTICE: This gem is out of support as of 2019-03-31

Please use https://github.com/titusfortner/webdrivers instead.

See #83 for details.


chromedriver-helper

Concourse CI

Easy installation and use of chromedriver, the Chromium project's Selenium webdriver adapter.

Description

chromedriver-helper installs an executable, chromedriver-helper, in your gem path, and configures Selenium to invoke it as the web driver.

This script will, if necessary, download the appropriate binary for your platform and install it into ~/.chromedriver-helper, then exec it. Easy peasy!

Individual projects can even select which version of chromedriver they want to run.

Make sure the gem is being required in order to configure the Selenium::WebDriver::Chrome.driver_path:

require "chromedriver-helper"

Otherwise you may see failures like "unable to connect to chromedriver 127.0.0.1:9515 (Selenium::WebDriver::Error::WebDriverError)" when Selenium runs the wrong executable.

Usage

In a Rails project

If you're using Bundler and Capybara in a Rails project, it's as easy as:

# Gemfile
gem "selenium-webdriver"
gem "chromedriver-helper"

then, in your spec setup:

Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

Standalone

If you're using it standlone just to manage chromedriver binaries,

# Gemfile
gem "chromedriver-helper"

Then just run the executable script:

chromedriver-helper

which will download chromedriver if necessary and exec it.

Configuration

There are some commandline options that can be sent to chromedriver as options to Capybara::Selenium::Driver.new. The supported options can be discovered by looking at the Selenium source code here:

https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/chrome/service.rb

As of this writing, the supported options are:

  • log_path
  • url_base
  • port_server
  • whitelisted_ips
  • verbose
  • silent

An example usage would be:

Capybara::Selenium::Driver.new(app, browser: :chrome,
  driver_opts: {
    log_path: '/tmp/chrome.log',
    verbose: true
  })

Updating to latest chromedriver

You can always update to the latest version of chromedriver:

chromedriver-update

Having problems updating?

If for whatever reason you're having problems getting chromedriver-helper to update to the latest chromedriver, try this:

  1. Delete the directory $HOME/.chromedriver-helper
  2. Run chromedriver-update

Specifying a version

If you want to run a specific version of chromedriver in your project, you can set the version in you testing setup like so:

Chromedriver.set_version "2.24"

Or, from the command line, you can choose a system-wide default:

chromedriver-update 2.24

Support

The code lives at http://github.com/flavorjones/chromedriver-helper. Open a Github Issue, or send a pull request! Thanks! You're the best.

Known Issues

chromedriver-helper affects other projects on my system

v1.2.0 and earlier installed an executable named chromedriver, which may cause confusion for apps on your system that are not using chromedriver-helper. v2.0.0 and later do not cause this problem.

The common symptom is an error message that looks like this:

Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9515

First, confirm that we're talking about the same thing by running:

bundle exec ruby -e "system('chromedriver -v')"

and making sure you see something like:

.../rubygems_integration.rb:462:in `block in replace_bin_path': can't find executable chromedriver for gem chromedriver-helper (Gem::Exception)

If you see this message, then uninstall all versions of chromedriver-helper prior to v2.0.0; and make sure your other projects have updated to v2.0.0 or later.

(You can read more about this issue at #57.)

CentOS 6 and 7

Some versions of chromedriver won't run on CentOS 6 and 7 due to the problems explained here. The error messages look something like:

chromedriver: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /home/vagrant/.chromedriver-helper/linux64/chromedriver)
chromedriver: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by /home/vagrant/.chromedriver-helper/linux64/chromedriver)
chromedriver: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /home/vagrant/.chromedriver-helper/linux64/chromedriver)

You can get chromedriver to work on these systems by running the install_chrome.sh script on the page linked to above, and then making sure your chromedriver process has LD_LIBRARY_PATH set so that /opt/google/chrome/lib is present, e.g.

$ LD_LIBRARY_PATH=/opt/google/chrome/lib chromedriver-helper
Starting ChromeDriver 2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f) on port 9515
Only local connections are allowed.

License

MIT licensed, see LICENSE.txt for full details.

Credit

The idea for this gem comes from @brianhempel's project chromedriver-gem which, despite the name, is not currently published on http://rubygems.org/.

Some improvements on the idea were taken from the installation process for standalone Phusion Passenger.

More Repositories

1

loofah

Ruby library for HTML/XML transformation and sanitization
Ruby
898
star
2

mini_portile

mini_portile and mini_portile2 - Simple autoconf and cmake builder for developers
Ruby
114
star
3

ruby-c-extensions-explained

Examples of C extensions in Ruby gems
C
89
star
4

loofah-activerecord

ActiveRecord sanitization using Loofah and Nokogiri
Ruby
72
star
5

lorax

XML/HTML diff generator, based on Nokogiri.
HTML
55
star
6

git-rake

Rake tasks for managing multiple git submodules
Ruby
33
star
7

bundler-as_of

Resolve rubygem dependencies as-of a date in the past.
Ruby
25
star
8

calendar-assistant

Command-line tool to manage your Google Calendar
Ruby
19
star
9

mcbean

McBean converts HTML into Markdown or Textile (and vice-versa).
Ruby
14
star
10

flexible-js-formatting

Mirror of Baron Schwartz's super-fast flexible-js-formatting project
JavaScript
12
star
11

emacs.d

A pathetic, messy, emacs configuration.
Emacs Lisp
9
star
12

hoe-bundler

Generate a bundler Gemfile from a Hoe spec's dependencies
Ruby
9
star
13

concourse-gem

Utility to ease management of Concourse pipelines. See https://concourse-ci.org/ to learn about Concourse.
Ruby
9
star
14

docker-truffleruby

Unofficial docker image configuration for TruffleRuby
Dockerfile
8
star
15

hoe-gemspec

Generate a prerelease gemspec for your Hoe-based project
Ruby
8
star
16

irc-notification-resource

Concourse CI resource for sending notifications to IRC.
Go
4
star
17

nis

Mirror (and gem source) for the NIS(YP) API rubygem.
C
4
star
18

webhook-notification-resource

Concourse resource for sending markdown-formatted messages to services like Discord and Gitter via webhook.
Ruby
4
star
19

concourse-deployer

Helper for deploying and maintaining a Concourse CI environment
Ruby
3
star
20

fairy-wing-throwdown

JSON v XML: How much slower is XML?
Ruby
3
star
21

release_marker

Integrate your deploys with Pivotal Tracker: release markers, changelogs and unicorns!
Ruby
2
star
22

flay-clang

Flay your C code!
Ruby
2
star
23

workshop

materials for Ruby on Rails intro workshop
Perl
2
star
24

nexus_dependency

If you've got dependencies on Nexus packages, resolve them, bundler-style.
Ruby
2
star
25

nokogiri-html5-inference

Given HTML5 input, make a reasonable guess at how to parse it correctly.
Ruby
2
star
26

windows-ruby-dev-tools-release

BOSH release to install Ruby dev tools on a Windows stemcell
PowerShell
1
star
27

github-league

Ruby
1
star
28

mcbean-heroku

Demonstration app for McBean.
JavaScript
1
star
29

2024-09-13-sqlite-corruption

Temporary repo, reproduction of sqlite database corruption.
Ruby
1
star