views:

1138

answers:

4

Hello! How is it possible to open FireFox browser by Ruby(for automation script)? I use @browser = RSpecSeleniumHelper.connect_browser('/admin/', '*firefox'), but it doesn't work.

+4  A: 

You can start any program in ruby with:

`firefox http://www.google.com`
or
system("firefox http://www.google.com")
Stevens
You can use %x[firefox http://www.google.com] as well.
khelll
A: 

You can use Watir, as it supports Firefox also: http://wtr.rubyforge.org/platforms.html

Jimmy Schementi
A: 

You may have to check if the Selenium Remote Control is start or not, normally it is running at port 4444.

java -jar selenium-server-xxx.jar

then you can use

@browser = Selenium::Client::Driver.new(
    :host => "localhost",
    :port => 4444,
    :browser => "*firefox", #*iexplore, *firefox3, *safari...
    :url => "http://www.google.com/",
    :timeout_in_second => 60)
@browser.start_new_browser_session

Hope this helps, you can find more demo by download Selenium RC

Jirapong
A: 

use watir, the best way

Jim