How can I fix my selenium and geckodriver bug on Cloud9?


#1

I want to fix my selenium and geckodriver bug on Cloud9 using capybara and launchy.

When I tried to feature tests using Rspec, the errors occurred.

The errors said that

Failure/Error: visit root_path
     Selenium::WebDriver::Error::WebDriverError:
       not a file: "/home/ubuntu/bin/geckodriver"
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/platform.rb:125:in `assert_file'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/platform.rb:129:in `assert_executable'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/service.rb:60:in `binary_path'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/service.rb:49:in `initialize'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:40:in `new'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:40:in `initialize'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/driver.rb:52:in `new'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver/common/driver.rb:52:in `for'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/selenium-webdriver-3.4.0/lib/selenium/webdriver.rb:88:in `for'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/capybara-2.4.4/lib/capybara/selenium/driver.rb:13:in `browser'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/capybara-2.4.4/lib/capybara/selenium/driver.rb:45:in `visit'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
     # /usr/local/rvm/gems/ruby-2.1.1/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
     # ./spec/support/features/about_us_spec.rb:6:in `block (2 levels) in <top (required)>'`enter code here`

The lists below are the challenges of mine trying to fix them.

â‘ install geckodriver

git clone https://github.com/mozilla/geckodriver

②give geckodriver path

export PATH=$PATH:/path/to/geckodriver

Here is my own surroundings.

ruby version 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
rails version 4.1.1

gem lists
  * actionmailer (4.1.1)
  * actionpack (4.1.1)
  * actionview (4.1.1)
  * activemodel (4.1.1)
  * activerecord (4.1.1)
  * activesupport (4.1.1)
  * addressable (2.5.1)
  * arel (5.0.1.20140414130214)
  * bcrypt (3.1.11)
  * bootstrap-sass (3.1.1.1)
  * builder (3.2.3)
  * bundler (1.14.6)
  * capybara (2.4.4)
  * capybara-webkit (1.14.0)
  * childprocess (0.7.0)
  * coffee-rails (4.0.1)
  * coffee-script (2.4.1)
  * coffee-script-source (1.12.2)
  * database_cleaner (1.3.0)
  * diff-lcs (1.3)
  * erubis (2.7.0)
  * execjs (2.7.0)
  * factory_girl (4.4.0)
  * factory_girl_rails (4.4.1)
  * faker (1.4.3)
  * ffi (1.9.18)
  * hike (1.2.3)
  * i18n (0.8.1)
  * jbuilder (2.6.4)
  * jquery-rails (3.1.4)
  * json (1.8.6)
  * launchy (2.4.3)
  * mail (2.5.4)
  * mime-types (1.25.1)
  * mini_portile2 (2.1.0)
  * minitest (5.10.2)
  * multi_json (1.12.1)
  * nokogiri (1.7.2)
  * polyglot (0.3.5)
  * public_suffix (2.0.5)
  * rack (1.5.5)
  * rack-test (0.6.3)
  * rails (4.1.1)
  * railties (4.1.1)
  * rake (12.0.0)
  * rdoc (4.3.0)
  * rspec-core (3.1.7)
  * rspec-expectations (3.1.2)
  * rspec-mocks (3.1.3)
  * rspec-rails (3.1.0)
  * rspec-support (3.1.2)
  * rubyzip (1.2.1)
  * sass (3.2.19)
  * sass-rails (4.0.5)
  * sdoc (0.4.2)
  * selenium-webdriver (3.4.0)
  * spring (1.7.2)
  * sprockets (2.12.4)
  * sprockets-rails (2.3.3)
  * sqlite3 (1.3.13)
  * thor (0.19.4)
  * thread_safe (0.3.6)
  * tilt (1.4.1)
  * treetop (1.4.15)
  * turbolinks (5.0.1)
  * turbolinks-source (5.0.3)
  * tzinfo (1.2.3)
  * uglifier (3.2.0)
  * websocket (1.2.4)
  * xpath (2.0.0)

I want to know how to solve them.
Is it possible to the browser tests like Firefox , Chrome and IE using capybara and selenium?


#2

Testing with IE is not possible, since it doesn’t run on ubuntu.
Others may be possible by using xvfb.

The clone command you used would just clone the source repo of geckodriver, it is better to install the prebuilt version

wget https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-linux64.tar.gz
tar -xvzf geckodriver*
chmod +x geckodriver
mkdir -p ~/bin
mv geckodriver ~/bin

https://askubuntu.com/questions/870530/how-to-install-geckodriver-in-ubuntu