Skip to main content
Version: 10.3

Switch to legacy UI element search

The guide describes how to switch to the legacy ways of searching for user interface (UI) elements in UI-rich JVM applications.

Current vs. legacy approach to search UI elements

Before v10, each search operation involved initializing a new tree traversal through UI components. Required components were returned as soon as they were found. Since searching for an element inside an application is a fast operation, no issues occurred when the legacy approach was used to work with UI-rich apps.

In v10, a new approach was introduced to simplify working with different types of applications and to provide customers with unified access to UI elements through XPath. According to the new approach, before getting any element, an entire tree of UI elements is built in an XML document and passed back to a bot execution application. Then, the XML document is utilized to look for a particular UI element, and the search results are applied in further operations.

However, the new approach entailed problems with UI-rich applications. In some cases, the component tree can be huge: for an application with 1 M cells in a table, the final XML document can reach up to 500 MB in size. Passing the document from a user process to a bot execution and the search itself take much more time as compared to the legacy approach.

Switch Object selectors to legacy logic

The 10.1.6.3 patch introduces the possibility of using both XPath and Object selectors and setting the latter to the legacy logic to work with AWT and Swing applications.

To set Object selectors to use the legacy logic, follow the instruction below:

  1. Go to RPA/bot-agent/conf/bot-agent-unit.yml.

  2. Using the standard -D switch, insert the rpa.objectselector.legacy variable and set it to true. For instance, you can insert the variable after the line as shown below:

    -Djvm.connector.path=../rpa-grid/dependency/jvm-connector.jar

    -Drpa.objectselector.legacy=true

If the rpa.objectselector.legacy variable is not specified or set to false, only the new 10.x approach is used. It means, after each search request, an XML document is generated for all UI components. In this case, pay attention to how rich your UI application is in terms of elements to avoid slowdowns.