Modern user interface frameworks are taking a lot of action to run as efficient as possible. One example for that are multiple tabs in a browser. There can just be one active tab at a time which is in the foreground. UI frameworks try to limit the resource consumption of the inactive tabs as much as possible. This means that e.g., some elements of a user interface are not getting rendered anymore, which is a pretty cool feature: It enables users to be able to open up many tabs in a browser without huge performance drops of the overall system. However, the inactive tabs which are running in a so called “headless mode” can cause some trouble when trying to automate them using an RPA bot. In this article, there will be a short introduction into dealing with applications in headless mode using SAP Intelligent Robotic Process Automation. In particular, I want to focus on accessing SAPUI5 tables running in a headless mode utilizing SAP Intelligent Robotic Process Automation as there is a lack of preconfigured functions in order to do so.

Run Headless Applications via SAP Intelligent Robotic Process Automation

RPA bot developers mostly come across headless applications when trying to run unattended bots as those bots might run on a system while the screen is locked. In this case you can observe a similar application behavior like described by the browser tab scenario in the introduction. Many application components are not getting rendered anymore and are therefore difficult to address by a bot.

The blog post by Thierry GOURDIN already describes several ways to deal with the limitations of locked screens. Besides several practical examples this blog also covers best practices to handle locked screens and disconnected virtual desktop infrastructure with SAP Intelligent Robotic Process Automation. However, not every issue could be solved as some actions still need an active session (unlocked screen).

A further blog post by Jerome Grondin therefore describes an easy way to unlock the screen in order to perform a certain action using the SAP Intelligent Robotic Process Automation Desktop Studio. However, in the meanwhile a lot of preconfigured functions of SAP Intelligent Robotic Process Automation Cloud Studio already come along this feature automatically. Therefore, in the settings of the SAP Intelligent Robotic Process Automation Desktop Agent the option “By opening a windows session with this account” has to be selected and the credentials of the Windows user need to be stored accordingly. The bot is now able to unlock the screen for a lot of functions whenever needed.

Accessing headless SAPUI5 tables

However, accessing an SAPUI5 table which is running in a browser in headless mode is not working yet. In a demo scenario, an SAP S/4HANA Cloud application, named Manage Product Hierarchies, was declared as an application. Among other elements, the user interface of the application consists of an SAPUI5 table. In the scenario, the values of this table should be read, even though the application is running on a disconnected virtual desktop infrastructure and is therefore running in a headless mode.

For debugging purposes, we can simulate the behavior when putting another browser tab in the foreground. The browser tab in which our SAP S/4HANA Cloud instance is displayed is now inactive. In the application tester (refer to following screenshot), we can see that the rows of our table are not getting recognized. Setting or reading a value will result in an error and even the get exists function will return false.

But if we now click on the inactive tab to bring it in the foreground and make it active, the elements of the table are getting recognized as expected.

In order to make the table accessible even in the headless mode, one needs to change the SAPUI5 parameter “visibleRowCountMode” of the table from “auto” to “fixed”.

To do so, the id of the table needs to be known, which can be achieved by using the preconfigured function Get Property (Element) using “id” (String) as an input. This function needs to be applied to the table itself, not just a row (which we in the end want to have). The table itself, meaning the div on top of the HTML hierarchy of the table, can be accessed even in headless mode. However, everything which is inside of this table (the rows we want to access), are not getting rendered yet.

Now that the id of the table is known, we can change the aforementioned parameter using a custom script and the following code. The parameter id is the return parameter of the Get Property (Element) function.

$.<application_identifier>.screens.<screen_identifier>.execScript(“sap.ui.getCore().byId(‘” + id +”‘).

setVisibleRowCountMode(‘Fixed’)”);

In the following, the table rows can be accessed as expected. Also, in the application tester, the table rows are getting recognized.

Summary

This article briefly summarizes many ways to automate headless applications using SAP Intelligent Robotic Process Automation. In order to access SAPUI5 tables, one can change the SAPUI5 parameter “visibleRowCountMode” of a table to “fixed” before accessing the table. This way it is possible to perform clicks, read and write operations and much more as it would be in an active session.

Please leave a comment below if you have any questions. You can also have a look at the official articles on SAP Help or the Q&A forum.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x