- 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)
- Browser Accessor APIs
- Browser Action APIs
- Miscellaneous APIs
- Sahi Scripting - Calling Java
- Exception handling using try-catch
- Recovering without try-catch using _setRecovery
- 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
- Other language drivers
Driving Sahi from Java, Ruby etc.
- Java
- Ruby
Exceptions are handled via regular javascript try catch blocks since Sahi V2.
Syntax
try{
// sahi statements
}catch(e){
// Corrective action
// Can print exact source of error in log
// Can throw the same or another exception
}
Eg.
Corrective Action
try{
_click(_link("does not exist"));
}catch(e){
_log("Exception occured"); // simple logging. no failure
_click(_link("linkByHtml")); // Corrective action
}
Corrective Action and Log the Exception Message
try{
_click(_link("does not exist"));
}catch(e){
_click(_link("linkByHtml")); // Corrective action
_logException(e); // Logs the exception, but does not fail
}
Corrective Action, Log and then Fail
try{
_click(_link("does not exist"));
}catch(e){
_click(_link("linkByHtml")); // Corrective action
_logExceptionAsFailure(e); // Logs the exception, and fails,
// and in the logs, points to the original line as source of failure.
}