I was hoping to get a web automation test script working on an AWS EC2 instance running Ubuntu 16.04 LTS with Ruby; Capybara and Cucumber frameworks.

I am intending to use Selenium-Webdriver as my web-driver (as opposed to waitr) and have also included Google's Chromedriver (Downloaded and extracted to the /usr/bin/ directory. and added to the server's $PATH variable.)

I am also intending to run this headlessly via Jenkins (as this is an AWS virtual server, it does not have any kind of GUI)

I am including the code being used. Please Note: I am attempting this in Ruby, but not rails!

ActiveSupport::Dependencies.autoload_paths << File.expand_path(File.join(Dir.pwd, 'lib'))
Selenium::WebDriver::Chrome::Service.executable_path = '/usr/bin/chromedriver'

  # On demand: non-headless tests via Selenium/WebDriver
  # To run the scenarios in browser (default: Firefox), use the following command line:
  # IN_BROWSER=true bundle exec cucumber
  # or (to have a pause of 1 second between each step):
  # IN_BROWSER=true PAUSE=1 bundle exec cucumber
  Capybara.default_driver = :selenium
  Capybara.current_session.driver.browser.manage.window.resize_to(1800, 1000)

  Capybara.register_driver :chrome do |app|
    require 'selenium/webdriver'
    profile = Selenium::WebDriver::Chrome::Profile.new
    profile['browser.helperApps.alwaysAsk.force'] = false
    profile['browser.cache.disk.enable'] = false
    profile['browser.cache.memory.enable'] = false
    client = Selenium::WebDriver::Remote::Http::Default.new
    client.timeout = 240 # instead of the default 60
    Capybara::Selenium::Driver.new(app, :browser => :chrome, :profile => profile, http_client: client)


When attempting to run this through Jenkins, I get the following error message:

not a file: "/usr/bin/chromedriver" (Selenium::WebDriver::Error::WebDriverError)
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/platform.rb:145:in `assert_file'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/platform.rb:150:in `assert_executable'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/chrome/service.rb:46:in `executable_path='
/var/jenkins_home/workspace/test/features/support/env.rb:12:in `<top (required)>'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/rb_support/rb_language.rb:96:in `load_code_file'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:84:in `block in load_files!'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `each'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/runtime/support_code.rb:83:in `load_files!'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:253:in `load_step_definitions'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:61:in `run!'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/bin/cucumber:23:in `load'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/bin/cucumber:23:in `<main>'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `eval'
/var/jenkins_home/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `<main>'
Build step 'Execute shell' marked build as failure

I've not figured out why Jenkins is throwing up this message (I haven't even gotten to the part about the actual display (Which I'm using Xvfb to imitate a screen)) Can you help?

  • Have you check this error " not a file: "/usr/bin/chromedriver" (Selenium::WebDriver::Error::WebDriverError) " May be you have not put chromedriver there
    – Sagar007
    Nov 15, 2016 at 11:26
  • @Sagar007 - Hmm. Now let me think... (Downloaded and extracted to the /usr/bin/ directory. and added to the server's $PATH variable.) - My original post - I think I have, but then; I could be in the Matrix
    – Raisus
    Nov 15, 2016 at 11:31
  • Sorry if that sounded sarcastic, but I don't tolerate fools gladly. It's one thing to ask a question; it's another to ask one that has already been answered and all you needed to do was read.
    – Raisus
    Nov 15, 2016 at 11:41
  • Sorry but sometimes very small mistakes can be happen by any person. We all do not know all the answer but new approach can help.
    – Sagar007
    Nov 15, 2016 at 12:33
  • @Sagar007 - True enough.
    – Raisus
    Nov 15, 2016 at 12:48

1 Answer 1


Okay, so I really was stuck and I couldn't figure it out; so I decided to try something different.

I disabled the docker image holding my Jenkins instance and instead loaded up my Apache2 Web server and installed Jenkins via:

sudo apt-get install jenkins

This immediately set up jenkins with a user on the AWS Ubuntu install.

I found out that, while on Docker, the Jenkins had not set up its user properly and so; when it came to looking for the binary files for chromedriver it was attempting to look at files it had no right looking in as it wasn't a registered user.

I could have probably edited Jenkins to use an appropriate user; but this worked just as well.

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.