Java Controller

abstract Sahi's Controller allows you to interact with Sahi and easily experiment and debug on the browser. This section explains using the Controller in Java mode, for writing scripts in Java instead of Sahi script (javascript)

Accessor Spy

Java Controller for Sahi Pro.

Identify Elements

To identify an element, press the CTRL key and hover over any element

Modes available in Sahi Pro for recording or identification:
  1. Browser: This mode is always enabled in Sahi Pro. Uncheck the checkbox for recording or identification in Browser mode only.
  2. Windows: Check the checkbox to enable recording or identification for Windows. Sahi Pro Desktop Add-on should be installed for this.
  3. Java Applet: For recording or identification in Java Applet mode Sahi Pro Desktop Add-on should be installed.
  4. Java Web Start: For recording or identification in Java Web Start mode Sahi Pro Desktop Add-on should be installed.

Action Buttons

These buttons perform various actions on the element and also show the generated script in the "Evaluate Expression" box. These are used to quickly work with elements during debugging/script generation.


Assertions are used to verify that the behaviour of the system is as expected. To add assertions using Sahi Java controller,
  1. CTRL-Hover on the element to identify it and then click on Assert button
  2. A few possible assertions for that element will be populated in the Evaluate Expression box
  3. Select mode for evaluate application of which it identified
  4. Click on Append button to append the assertions to the script.

Evaluate Expression

Evaluate Expression box is used to evaluate snippets of Sahi Java code. It helps while identifying elements or while debugging.
info Note: Selecting some text and pressing "→" will only evaluate the selected text. User may evaluate more than one statement at a time.

Record a script

  1. Choose the type of application for recording or identification.
  2. Click on 'Record' button and perform desired actions on the web page.
  3. Click on 'Stop' button to stop recording.
  4. Then click on 'Recorded Steps' button and it will show all the recorded steps.
  5. 'Clear' button is used to clear all the recorded steps.