Sahi Documentation

Applet Automation Using Only Desktop Automation

abstract This section details how to automate Java Applets using only Desktop Automation. If you are not familiar with Applet Automation, refer Applet Automation.


Java Applets can be automated using only Desktop Automation. For this, the Applet elements need to be automated using JAVA mode while the elements on browser need to be automated using WINDOWS mode.

Pre-requisites

  1. You need Sahi Pro version v10.0.0 or above
  2. Sahi Pro Desktop Add-on needs to be installed.
  3. ONLY Desktop capabilities should be enabled. (Needs only Sahi Pro Desktop Add-on license)
  4. Enable the following property in the userdata.properties file.
    windows.identification_on_browser_for_applet.enabled=true

Recording an Applet

  1. From the Sahi Dashboard, launch the Desktop Controller by clicking the Desktop icon on the Sahi Dashboard.
  2. Execute the API _launchBrowserForApplet and launch the browser for applet.
    _launchBrowserForApplet("https://www.test.example.com/login", "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe");
  3. You can now start recording. As with normal Sahi, you can use CTRL-Hover to identify various elements on the applet.
  4. When recording on the browser, in the Controller ensure the checkbox for "enable recording/identification for Windows" is checked.
  5. When recording on the applet, in the Controller ensure the checkbox for "enable recording/identification for Windows" is unchecked.
  6. Use of Java Mode

    1. To use "Evaluate expression" on Java applets, choose "Sahi-Java".
    2. Ensure that the script contains _launchBrowserForApplet API to launch the browser for applet.
    3. For script playback, in Controller Playback tab, select Start Mode as "Java" and click "Play".