Ruby driver for Sahi

warning We recommend using the JS (Sahi) scripting language. Please read our recommendations before deciding on the Ruby driver.
The Ruby driver for Sahi is available as a gem. install:
gem install sahi

This gem is a ruby client for the Sahi proxy. Sahi needs to be installed on your system for this to work. If you are new to Sahi, read using sahi section to get familiar. Have a look at sahi_test.rb in the sahi/ruby/ folder to see how this driver is used.

Full documentation is available as RDocs A small example:
require 'test/unit'
require "sahi"

class SahiDriverTest < Test::Unit::TestCase
 def setup
    @browser = init_browser()

  def teardown
    if @browser

  def init_browser()
   # Look at sahi/userdata/config/browser_types.xml to configure browsers.
    @browser_name = "firefox"

  def test_google()
    @browser.textbox("q").value = "sahi forums"
    @browser.submit("Google Search").click"Forums - Sahi - Web Automation and Test Tool").click"Login").click
    assert @browser.textbox("req_username").exists?

Recording Ruby code

  1. Open sahi/config/ and set controller.mode=ruby
  2. Restart Sahi
  3. Open a fresh browser with the proxy configured and navigate to any website.
  4. Press CTRL-ALT and DblClick on the page to bring up the Sahi Java Controller.
  5. Click on the record button and start performing actions on the browser. Steps will be visible in the "Recorded Steps" section.
  6. Copy the code from the Sahi console and paste it into your Ruby script.