- 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
Sometimes it is necessary to do some corrective action in case a test fails half way through.
This is different from try-catch because we do not want the script to continue; we just want the state of our system to be restored to a sensible point.
The relevant APIs are:
_setRecovery(fn)
_removeRecovery()
Any function can be assigned to a script as a recovery function.
Once set, if there is an error during execution, the recovery function will be called before the script stops.
Eg.
_navigateTo("http://sahi.co.in/demo/");
function myRecoveryFn(){
_alert("In myRecoveryFn."); // This statement will be alerted in case of script error.
}
_setRecovery(myRecoveryFn); // Set the myRecoveryFn as recovery function.
_click(_link("Link Test")); // Works normally
_click(_link("Bad Link"));
// This statement fails and causes myRecoveryFn to be called.
_alert("done");
// This statement will not be called, because script failed in the last statement.
The recovery function can be removed via _removeRecovery();