0

I have a setup that runs on mac fine (currently launches browser and uses chromium), what i need to do now though is get this running on Ubuntu 14.04 (Amazon EC2 instance), and have chrome or chromium running heedlessly. I have tried quite a few things now and when running a cucumber test i get the following error every time

unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.13.0-116-generic x86_64) (Selenium::WebDriver::Error::UnknownError)

This is my current setup

# Gemfile
source 'http://rubygems.org'

gem 'rake'
gem 'cucumber', "~> 2.4.0"
gem 'capybara'
gem 'rspec-expectations'
gem 'selenium-webdriver', "~> 3.0.0"
gem 'chromedriver-helper'
gem 'retriable', '~>1.4'

# env.rb

Capybara.register_driver :chrome do |app|
 chrome_binary = "/usr/bin/google-chrome"

 capabilities = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => { "binary" => chrome_binary, "args" => ['headless', 'disable-gpu'] })
 Capybara::Selenium::Driver.new(app, :browser => :chrome, :desired_capabilities => capabilities)
end

I have also installed chrome driver and xvfb

sudo apt-get install xvfb

wget -N http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
chmod +x chromedriver

sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver

though when running which chromedriver it outputs

/home/ubuntu/.rvm/gems/ruby-2.3.0@hendricks-as3-integration/bin/chromedriver

so i uninstalled the chromedriver-helper gem and when running /usr/bin/chromedriver i get

Starting ChromeDriver 2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac) on port 9515
Only local connections are allowed.

Is there a way to specify what chromedriver to use?

Has anybody got experience with setting this up or perhaps can spot something that i have not done?

Any help appreciated

Thanks

Any help would be appreciated..!

1
  • Chrome Driver and Chrome are separate, you'll need to ensure you also have Chrome installed on the remote machine or use Selenium Grid. Commented Oct 15, 2018 at 19:31

1 Answer 1

1

Just for the internets sake. You need to add no-sandbox to your args.

"args" => ['headless', 'disable-gpu', 'no-sandbox']

https://github.com/SeleniumHQ/selenium/issues/4961

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.