`selenium-webdriver` ruby gem cannot connect with chromedriver on Ubuntu 14.04

I have tried it on the Ubuntu 16.04 (updated) and ruby which comes with the system ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu].

From what I guess is that you are using wrong, old (in the guide there is version 2.26 which will not work with current chrome), chromedriver, which is not compatible with the current stable chrome.

The current stable chrome is Unpacking google-chrome-stable (71.0.3578.98-1) ... and so you need to get chromedriver as close as possible to the chrome version.

To get complete list of chromedrivers' versions click here.

In my case that would be a 71.0.3578.80 version:

wget -N http://chromedriver.storage.googleapis.com/71.0.3578.80/chromedriver_linux64.zip

You can then continue as shown at the instructions.

Then you will get working selenium-webdriver:

irb
irb(main):001:0> require 'selenium-webdriver'
=> true
irb(main):003:0> options = Selenium::WebDriver::Chrome::Options.new
=> #<Selenium::WebDriver::Chrome::Options:0x00000002ee6db0 @args=#<Set: {}>, @binary=nil, @prefs={}, @extensions=[], @options={}, @emulation={}, @encoded_extensions=[]>
irb(main):004:0> options.add_argument('--headless')
=> #<Set: {"--headless"}>
irb(main):005:0> @driver = Selenium::WebDriver.for(:chrome, options: options)
=> #<Selenium::WebDriver::Chrome::Driver:0x..f95c429ee62a3a152 browser=:chrome>

Note: If you have issues installing ffi install libffi-dev via apt-get.


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

This will keep your version up to date and available. I have had this solve similar problems that were encountered during CI testing. You should be able to setup your @driver afterwards.