- 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 headless with PhantomJS
- Sahi headless with Xvfb
- Sahi with Android
- Tweaking Sahi APIs
- Jenkins Integration
- Other language drivers
Driving Sahi from Java, Ruby etc.
- Java
- Ruby
- Trouble Shooting Sahi
- Sahi Pro
- Documentation (PDF)
- Excel Framework
- Load Testing (Beta)
- Sahi Flex Support - sfl (Beta)
- Running tests on multiple machines
While interacting with databases or while calling custom java code from Sahi scripts, the necessary classes or jars need to be added to Sahi’s classpath.
From command-line
If you are using start_sahi.bat or start_dashboard.bat, edit it and modify
SET SAHI_EXT_CLASS_PATH=
to
SET SAHI_EXT_CLASS_PATH=path/to/your/jar
Example:
SET SAHI_EXT_CLASS_PATH=..\..\extlib\db\mysql-connector-java-5.0.4-bin.jar;
SET SAHI_EXT_CLASS_PATH=%SAHI_EXT_CLASS_PATH%;C:\mypath\custom.jar
In the above example, we are adding 2 jars to the classpath. Note the following
- mysql-connector-java-5.0.4-bin.jar is the mysql jdbc driver which has been copied to sahi/extlib/db directory. custom.jar is in C:\mypath.
- You can keep your jar anywhere and use its absolute path or a path relative to where you start Sahi from.
SAHI_EXT_CLASS_PATH is where you add your database drivers.
- On linux use : (colon) instead of ; (semi-colon) to separate jars in the classpath
From ant
If you are using ant, use:
<target name="startsahi" description="starts proxy">
<java classname="net.sf.sahi.Proxy" fork="true">
<classpath>
<path path="classes"/>
<pathelement location="extlib/rhino/js.jar"/>
<pathelement location="extlib/apc/commons-codec-1.3.jar"/>
<pathelement location="extlib/db/mysql-connector-java-5.0.4-bin.jar"/>
<pathelement location="C:/mypath/custom.jar"/>
</classpath>
<arg value="." id="basePath"/>
<arg value="./userdata/" id="userdataPath"/>
</java>
</target>
Make sure to change the pathelement locations properly. (Relative to where you are running the target from.)