Sahi Pro - Sahi Applet Support (Beta)

Introduction

Sahi Pro V4.5 and higher versions provide support for automation of applets.

For automating your applets you need to configure Sahi for applet support.

  1. Open /config/sahi.properties
  2. Set the below statement to true and save this file
    applet_support.enabled=true
  3. Restart Sahi.

Automating Oracle Forms

For automating Oracle Forms following steps need to be done

  1. Open "Configure Sahi" page by clicking on "configure" link on Sahi's Dashboard.
  2. Click on “download_contenttypes.txt”.
  3. Remove the following line from download_contenttypes.txt.
  4. application/octet-stream
  5. Click Save.
  6. Restart Sahi.

Recording an Applet

From the Sahi Dashboard, open any browser and navigate to the page containing your applet.
Press ALT and double click on the document window of the page which you want to record (outside applet area). Sahi's Controller window will popup. You can now start recording. As with normal Sahi, you can use CTRL-Hover to identify various elements on the applet.

NOTE: Sahi currently automates only Java Swing based applets

Applet APIs

Applets APIs are different from the normal JavaScript APIs. All elements are prefixed with

_a("appletId").
or
_applet("appletId").
followed by the component type and component id.

Example:
_a("SampleApplet").jbutton("Test Button")
or
_applet("SampleApplet").jbutton("Test Button")
_a and _applet API's can be used interchangebly.

Applet also supports near, inside and under APIs.

Example:
_a("SampleApplet").jcombobox("").near(_a("SampleApplet").jlabel("Mouth"));

_highlight(_a("SampleApplet").jcombobox("").under(_a("SampleApplet").jlabel("Mouth")));

_setSelected(_a("SwingSet2Applet").jcombobox(3).near(_a("SampleApplet").jlabel("Mouth")),"Larry");

_click(_a("SwingSet2Applet").jbutton("sun_small.gif"));
Some more detail on Applet APIs

Trouble Shooting

Java security error while loading applets with Sahi

Following security error may occur while automating applets with Sahi.
Solution
  1. Open Java Control Panel.
  2. Where is Java Control Panel in Windows
    Where is Java Control Panel in Mac
  3. Select "Enable - hide warning and run with protections" Security verification option as shown in below image.

Page hangs or Sahi does not recognize any element

While automating applets using Sahi make sure that java uses browser's proxy setting.
This can be configured in Java Control Panel as shown in below images.

Applet: Delete Java Cache

  1. Click on the Start button and then click on the Control Panel option.
  2. In the Search Control Panel enter Java.
  3. Click on the Java icon to open the Java Control Panel.
  4. In the Java Control Panel, under the General tab, click Settings under the Temporary Internet Files section.
  5. The Temporary Files Settings dialog box appears.
  6. java_temp_file
  7. Delete Temporary Java Files through Java Control Panel
  8. java_delete_temp_files
  9. Make Temporary Files not to store on your computer.
  10. java_donotkeep_temp_files

Sample applet

A sample applet is available at http://sahi.co.in/demo/applet/simple.htm