# How to use Selenium RC in Rails

**URL:** <https://www.ruby-forum.com/t/how-to-use-selenium-rc-in-rails/189876>\
**Category:** Rails\
**Created:** [June 9, 2010, 10:23am UTC](https://www.ruby-forum.com/t/how-to-use-selenium-rc-in-rails/189876 "2010-06-09T10:23:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/5e9695/32.png) [@wny](https://www.ruby-forum.com/u/wny)\
**Post date:** [June 9, 2010, 10:23am UTC](https://www.ruby-forum.com/t/how-to-use-selenium-rc-in-rails/189876/1 "2010-06-09T10:23:08Z")

</div>

Hi,

I am trying to use Selenium RC in my rails application. I first  
install selenium RC ruby client (\>gem install selenium-client). Then  
create a “selenium\_test.rb” in libs folder. In the file, I create a  
class “SeleniumTest”.

# libs/selenium\_test.rb

require “selenium-client”

class SeleniumTest  
attr\_reader :browser

def initialize  
@browser = Selenium::Client::Driver.new   
:host =\> “localhost”,  
:port =\> 4444,  
:browser =\> “\*firefox”,  
:url =\> “[http://www.google.com](http://www.google.com)”,  
:timeout\_in\_second =\> 60  
end  
end

In a controller file, I create an instance of this class.

o=SeleniumTest.new

When I run rails, it returns an error:

LoadError in LoginsController#create  
no such file to load – selenium-client

I tried to add the following require settings in /config/  
development.rb. No helpful.

require “rubygems”  
gem “selenium-client”, “\>=1.2.17”  
require “selenium/client”

I am new in Rails. It seems a quite simple task. I have some third-  
party library and want to use in my code. In C#, I just add the  
reference, then specify its namespace in the top of the file. It is  
actually similar in Ruby code. But for Rails, I do not know how to  
reference external lib. Could someone here help me? Really appreciate.
