- Explore
Introduction, screen-shots, features, limitations
- Getting started
Prerequisites, download, install, browser configuration, record, playback, view logs
- Sahi Scripting Basics - I
Statements, variables, functions, conditions and looping, _include
- Sahi Scripting Basics - II
- Sahi APIs (built-in functions)
- All APIs
- Browser Accessor APIs
- Browser Action APIs
- Miscellaneous APIs
- Sahi Scripting - Calling Java
- Exception handling using try-catch
- Recovering without try-catch using _setRecovery
- Script lifecycle call back functions
onScriptFailure, onScriptError, onScriptEnd
- Data Driven Testing
_getDB, CSV Files, Excel, Databases
- Multithreaded Playback (Parallel execution)
suites, commandline, ant
- Advanced techniques, tips and examples
- HTTPS/SSL Sites
- Configuring an External proxy
- Adding jars to Sahi's classpath
- Configuring Browser Types
- Sahi GUI Less Installation
- Sahi headless with PhantomJS
- Sahi headless with Xvfb
- Sahi with Android
- Tweaking Sahi APIs
- Jenkins Integration
- Sending Emails
- CSV Files as Suites with Tags
- Working with SSH
- Reading PDF Files
- Run Sahi Scripts from Java
- Other language drivers
Driving Sahi from Java, Ruby etc.
- Java
- Ruby
- Trouble Shooting Sahi
- Sahi Pro
- Sahi Pro V4.2 Documentation (PDF)
- Excel Framework
- Load Testing (Beta)
- Sahi Flex Support - sfl (Beta)
- Sahi Applet Support (Beta)
- Running tests on multiple machines
- Web based Testrunner
The Ruby driver for Sahi is available as a gem. http://rubygems.org/gems/sahi
To 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 http://sahi.co.in/w/using-sahi 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()
@browser.open
end
def teardown
if @browser
@browser.close
sleep(1)
end
def init_browser()
# Look at sahi/userdata/config/browser_types.xml to configure browsers.
@browser_name = "firefox"
return Sahi::Browser.new(@browser_name)
end
def test_google()
@browser.navigate_to("http://www.google.com")
@browser.textbox("q").value = "sahi forums"
@browser.submit("Google Search").click
@browser.link("Forums - Sahi - Web Automation and Test Tool").click
@browser.link("Login").click
assert @browser.textbox("req_username").exists?
end
end
Recording Ruby code
- Open sahi/config/sahi.properties and set controller.mode=ruby
- Restart Sahi
- Open a fresh browser with the proxy configured and navigate to any website.
- Press CTRL-ALT and DblClick on the page to bring up the Sahi Java Controller.
- Click on the record button and start performing actions on the browser. Steps will be visible in the “Recorded Steps” section.
- Copy the code from the Sahi console and paste it into your Ruby script.