How to enter a variable in a CSS/UI selector


In WinAutomation and ProcessRobot, CSS/UI selectors within the Controls Repository can accept variables in order to become more dynamic.

The below example demonstrates the alternation of an Excel Window's UI Selector. More specifically, the window's "name" attribute will be modified via the "Set Variable" action.

Excel selectors control properties

In order to achieve this, follow the below steps within Process Designer.

  • Set a variable as %name% = Book1 - Excel.

  • Navigate to the Controls Repository and double click on the relevant UI Selector.

  • In the pop-up window, click on Edit.

  • In the Selector Builder window, change from Visual Selector Builder to Custom, via the dropdown list at the top left side.

  • Click on the gear icon in order to locate and insert the %name% variable to your Selector.

    At the end, it should look like this. :desktop > window[name="%name%"][process="EXCEL"]

  • Click on the Update button in order to complete the procedure.

Finally, test the new Selector's validity via the "Focus Window" action. You can always import the process provided below.

Additional resources