Sahi - Java GUI Application Automation

abstract This section details how to test Java Application.
If you are not familiar with Sahi Pro, please see Quick Tutorial on Sahi Pro

Introduction

Sahi Pro Desktop Add-on provides support for automation of Java Application.

Installation

Download Sahi Pro and Sahi Pro Desktop Add-on from Downloads Archive.
Install Sahi Pro into a folder without spaces in its path.
Then install Sahi Pro Desktop Add-on into the same folder as Sahi Pro.
For details about installation please refer here

License

Sahi Pro Desktop Add-on needs a separate license from Sahi Pro.
Register here for a 30 day fully functional trial version.

Recording Java Application

  1. Before the starting the Java application, we need to attach Sahi's agent.
    This can be done by passing -javaagent:...agent.jar to the java command which starts your application.
    We recommend creating a batch file to invoke your jar file and modifying it like this:
    Open the batch file which is being used to run the Java Application. Append the following lines in the batch file:

    SET SAHI_JAVA_AGENT_PATH=<sahi_pro_path>\extlib\sahi\sahiagent.jar
    SET JAVA_TOOL_OPTIONS=-javaagent:"%SAHI_JAVA_AGENT_PATH%"
    ... java command to start your application ...
    Change <sahi_pro_path> accordingly.

  2. From the Sahi Dashboard, open any browser and launch the Controller.
    You can now start recording.
    Like normal Sahi, you can use CTRL-Hover to identify various elements on the Java Application.

info Security Settings

If the web start application is not behaving as expected, you might need to set Java security settings as follows:
  1. Find the <JAVA_HOME>\lib\security\java.policyfile.
  2. Edit the file with these settings:
  3. grant {
    ...
    ... Existing permissions ...
    ...
    
    permission java.security.AllPermission;
    };

Scripting Notes