Skip to content
Get Free Trial

Java GUI Application Automation

This section details how to test Java Application. If you are not familiar with Sahi Pro, see Quick Tutorial on Sahi Pro To automate java applications using Sahi Pro Flowcharts, refer Java GUI Application Automation.

Sahi Pro Desktop Engine provides support for automation of Java Application.

  • Bring up the browser of your choice by clicking on any of the browser icons present on Sahi Dashbord.

  • Enter Java application jar file path in the space provided for “start URL” and click “GO” , to start the application (Download and save the Java aplication on local file system before hand).

  1. Open a command prompt and cd to sahi/userdata/bin (or click on the “Bin” link on the Sahi Dashboard).

  2. For Windows: Invoke java_app.bat with the Java application jar file path to start the application
    (Download and save the Java aplication on local file system before hand).

    D:\Sahi_Pro\userdata\bin>java_app.bat <java -jar applicationPath>
  3. For Linux: Invoke java_app.sh with the Java application jar file path to start the application
    (Download and save the Java application on local file system before hand).

    ~/sahi_pro/userdata/bin>./java_app.sh <java -jar applicationPath>
  4. To Launch Sahi Controller, click the Desktop icon on the Sahi Dashboard.

    You can now start recording. Like normal Sahi, you can use Ctrl-hover (⌘-hover on Mac) to identify various elements on the Java Application.

  1. To use “Evaluate expression” on Java GUI applications, choose "Sahi-Java".

  2. To run the script from the Controller, set its mode to Java, then click Run.

  • To start a Java application from script, use

    _execute("correct/path/your_application.bat");
  • To start a Java application _launchJavaApplication($javaApplicationPath) API.

  • All code interactions with Java application will need to be preceded by _setMode(“JAVA”)