I am testing a selenium web relay with phantoms from Ruby on Rails. I am testing locally on my computer.
The following code works fine in my Ruby script test when I run "ruby test.rb"
def google_title require 'selenium-webdriver' driver = Selenium::WebDriver.for :phantomjs driver.navigate.to "https://www.google.com" page_title = driver.title puts page_title end google_title
I have almost the same code in the application_controller.rb file:
def google_title require 'selenium-webdriver' driver = Selenium::WebDriver.for :phantomjs driver.navigate.to "https://www.google.com" page_title = driver.title render text: page_title end
But when I launch my application, I get the error message "I canβt download such a file - selenium-webdriver".

I added this to my Gemfile and installed the package, but I get the same error.
gem 'selenium-webdriver', '~> 2.45'
When I run the gem --local list, it shows that selenium is installed.
Any help would be appreciated.
Update:
I used almost the same code as above, but with watir-webdriver and got the same results. The Ruby script did a great job of this, but gave the error βcan't load such a fileβ for watir-webdriver when I tried to run it from Rails.
I ran another test with the nokogiri and it worked fine. Both he and Rails.
Update2:
I seem to be doing something, not my test environment. I just ran the same code in the online IDE and got the same type of errors:

Update3:
Here is the full content of the application_controller.rb file when I run the test using watir-webdriver and headless. I get the same results. Maybe I'm installing something wrong here?
class ApplicationController < ActionController::Base def google_title require 'watir-webdriver' require 'headless' headless = Headless.new headless.start b = Watir::Browser.start 'www.google.com' page_title = b.title b.close headless.destroy render text: page_title end end
