Java application UI automation library using Java Access Bridge technology.

Library is at the beta level at the moment so feedback is highly appreciated.

The library utilizes java-access-bridge-wrapper package to interact with Java UI. Currently only the 64-bit Windows OS is supported.

Steps to enable

  1. Enable the Java Access Bridge in Windows
  2. Set environment variable RC_JAVA_ACCESS_BRIDGE_DLL as an absolute path to WindowsAccessBridge-64.dll
C:\path\to\java\bin\jabswitch -enable
set RC_JAVA_ACCESS_BRIDGE_DLL=C:\Program Files\Java\jre1.8.0_261\bin\WindowsAccessBridge-64.dll

Locating elements

To automate actions on the Java application, the robot needs locations to various elements using a feature called locators. Locator describes properties of an element.

At the moment library contains basic level support for locators.

The common locator types are name and role.

To identify element with more than one property and can be used, for example:

role:push button and name:Clear

To address element within parent element > can be used, for example:

name:Find Purchase Orders > name:NumberField

Some keywords accept element as an parameter in place of locator.

Interacting with elements

By default application elements are interacted with Actions supported by the element. Most common example is click action supported by an button element.

But because application and technology support for the actions might be limited, it is also possible to opt for interaction elements by their coordinates by giving keyword parameter action=False if parameter is available.

Inspecting elements

Inspecting Java application elements depends on what kind of Java UI framework the application has been built with.

The Accessibility Insights for Windows can show element properties if application framework supports Windows UI Automation (UIA), see more at using Accessibility Insights.

The Google's Access Bridge Explorer can also be used for inspecting Java application elements.

Examples

robotframework

*** Settings ***
Library   RPA.JavaAccessBridge
Library   Process

*** Tasks ***
Write text into Swing application
    Start Process    java -jar BasicSwing.jar
    ...              shell=${TRUE}
    ...              cwd=${CURDIR}
    Select Window    Chat Frame
    Type Text    role:text
    ...          text for the textarea
    Type Text    role:text
    ...          text for the input field
    ...          index=1
    ...          clear=${TRUE}
    Click Element    role:push button and name:Send

Python

from RPA.JavaAccessBridge import JavaAccessBridge
import subprocess

jab = JavaAccessBridge()

subprocess.Popen(
    ["java", "-jar", "BasicSwing.jar"],
    shell=True,
    cwd=".",
    close_fds=True
)
jab.select_window("Chat Frame")
jab.type_text(
    "role:text",
    "text for the textarea",
    enter=True
)
jab.type_text(
    "role:text",
    "text for the input field",
    index=1,
    clear=True
)
jab.click_element("role:push button and name:Send")