Open Firefox browser with Ruby automation script

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.


You can start any program in ruby with:

`firefox http://www.google.com` or system("firefox http://www.google.com")


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


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


I encountered two issues while getting this running:

<ol> <li>

If you are running your Ruby app from MacOS, the command firefox may not be properly aliased by default and so may fail without errors printed to your Ruby console.

</li> <li>

If you already have an instance of Firefox open, you will get a message saying "Close Firefox - A copy of Firefox is already open. Only one copy of Firefox can be open at a time."

</li> </ol>

This code fixes both problems:

system("open -a /Applications/Firefox.app/Contents/MacOS/firefox-bin http://www.google.com http://www.cpap.com") <ol> <li>open's -a option Opens with the specified application.</li> <li>The file path list works for me. If it won't load for you, first drop it and try plain "firefox" and failing that try "/Applications/Firefox.app/Contents/MacOS/firefox"</li> <li>The example above shows two URLs separated by a space. You can use just one URL or as many as you care to following this pattern.</li> </ol>


  • How to test chat web app
  • Python: selenium-chromedriver error on new browser object
  • How to export Selenium Test Suite/Case as C#
  • Selenium Firefox WebDriver in WCF throwing “failed to start up socket within 45000 ms”
  • How do I retrieve the text in a table column using Selenium RC?
  • How to capture or listen to browser notifications?
  • receiving X509 client certificates in web requests
  • Can you use multiple instances of Edge on a Selenium Grid Node?
  • integrate POCO library in android ndk
  • CORS with socket.io
  • “mvn clean generate-source” could not resolve dependencies
  • In Java, how can I construct a File from a resource?
  • MySQL performance when updating row with FK
  • Prevent Tomcat from caching request during starup
  • Simple linked list-C
  • Android Studio Can't Find tools.jar
  • Sending keystrokes/mouse clicks to a Java program with Autohotkey
  • Center align outputs in ipython notebook
  • Selenium to click on a javascript button corresponding to a text
  • Access Android Market through SSH tunnel
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Recording logins for password protected directories
  • Is there any way to access browser form field suggestions from JavaScript?
  • Splitting given String into two variables - php
  • Resize panoramic image to fixed size
  • Volusion's generic SQL folder, functionality
  • Cross-Platform Protobuf Serialization
  • Check if a string to interpolate provides expected placeholders
  • ActionScript 2 vs ActionScript 3 performance
  • jquery mobile loadPage not working
  • How can I estimate amount of memory left with calling System.gc()?
  • Apache 2.4 - remove | delete | uninstall
  • How to format a variable of double type
  • How to get icons for entities from eclipse?
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • JaxB to read class hierarchy