Skip to end of metadata
Go to start of metadata


Inspector is a built-in tool to explore properties and values of objects located in the application which you automate with your recording, providing functionality for quick element selector search.

Selectors can be extracted only with the help of specific tools, one of which is Inspector as a part of WorkFusion Studio.

The usual workflow contains the following steps: Inspect UI controls > Check selectors > Apply selectors.

General Overview

To perform actions in any desktop application, a bot has to find particular elements to interact with (type, click, focus, etc.). For that purpose, a selector, or a unique link to a window or UI control, is used.

A selector is a unique property or the combination of several unique properties related to windows or UI controls. It is captured as a property name and a property value. The result is inserted into the Selector field to let the bot know which object to click. The most commonly used selector properties are enumerated in the table below.

PropertyDescriptionCSS SelectorObject SelectorXPath Selector
CLASSclass.TextBlock
[CLASS:TextBlock]
//*[@class='TextBlock']
TITLEtitle.ApplicationWindow[title="Calendar"][CLASS:ApplicationWindow; TITLE:Calendar]
//*[@class='ApplicationWindow'][@title='Calendar']
NAMEinstance name.TextBlock[name="calendarLabel"]
[CLASS:TextBlock; NAME:calendarLabel]
//*[@class='TextBlock'][@name='calendarLabel']
TEXTtext attribute.TextBlock[text="2019"]
[CLASS:TextBlock; TEXT:2019]
//*[@class='TextBlock'][@text='2019']
INSTANCEinstance number.TextBlock[instance="48"]
[CLASS:TextBlock; INSTANCE:48]
//*[@class='TextBlock'][@instance='48']

The class and title properties are used to define both applications and UI controls, while others are applied for UI controls only.

Launching Inspector

To open Inspector, do as follows.

  • Press the Start Inspector button () on the RPA Recording toolbar, or
  • Use Ctrl + Shift + I, or
  • Go to Window > Inspector > Start Inspector.

Once you invoke Inspector, its window appears on the screen.

(1) Browser contains either all the currently running applications, or the list of UI controls when exploring the selected window.

(2) Result List displays the list of all properties related to the selected window or UI control.

(3) Selector is the field to hold a unique selector.

(4) Type allows to switch between selector types. On selecting an item in the Type filter, the selector string is rebuilt to match the given notation.

There are three selector types you can choose from:

  • CSS

    CSS selector example
    .Button[name="Maximize"]
  • Object

    Object selector example
    [CLASS:Button; NAME:Maximize]
  • XPath

    //*[@class='Button'][@name='Maximize']

    XPath selectors can be used to locate elements in desktop applications starting from RPA Express 2.3.0.

Inspecting UI Controls

You can inspect UI controls by different ways.

  • Сapture (inspect) controls by hovering over them.
  • Select controls in the Browser tree as in developer tools.
  • Check how UI controls work in applications by setting commands.
  • Test if controls match given selectors by using the search function.

To start exploring application components, select the application you want to inspect in Browser .

In case you launched an application after launching Inspector, click Refresh Browser () to update the list.

If a process is run by the system or other user, it cannot be inspected. Then, you are notified about a necessity either to run Inspector as Administrator or disable the user account control.

 See more details

Available from RPA Express 2.2.0.

Inspection of SAP GUI desktop client differs from the usual inspecting workflow. To see more information on the topic, refer to SAP GUI Desktop Automation.

Capturing

Inspector provides the Capture option enabling you to enter the inspection mode and explore properties of application components on hovering over them.

  1. Click Capture.
  2. Hover the cursor over a window control. It gets highlighted directly in the application.

  3. Click the desired window control to select it. The target control opens in the Inspector window automatically, with its properties displayed in Result List and a selector value available in the Selector field.

    There are cases when you need to click a control without selecting it, e.g., to explore other application options or switch to another application. Use the black menu as a prompt.

    • To click the control without selecting, use the left mouse click + Ctrl.
    • To cancel capturing and exit the inspection mode, press Esc.

Exploring in Browser

In case it is challenging to get the right selector by capturing, e.g. it is hidden in the application UI, or you do not want to click through the application, you can switch between controls directly in the Browser area.

  1. Double-click the application or process in Browser, or click Show UI Components in Result List.

  2. Navigate in Browser using the mouse or keyboard arrows.

    The selected component gets highlighted in the application window. Its properties are available in Result List together with the corresponding selector in the Selector field.
  3. To exit the inspection mode, click Back to Applications and Windows in Browser

Testing Windows and UI Controls

Apart from highlighting, you can send different actions to any desired application or window control in order to emulate bot's behavior and make sure it functions as expected.

To check that the bot is able to actually interact with the application and its components (e.g., Notepad), do as follows.

  1. To test interaction with the application, select the application in Browser, right-click, and select one of the commands, e.g., Type ("hello"). The command is performed in the application window.
  2. To test if the application components respond, double-click the application in Browser, or press Show UI Components in Result List. Select any of the components in Browser, right-click, and select one of the commands, e.g., Click. The command is performed for the selected component.

To view/hide applications and elements within them, press Expand/Collapse in front of the application or process you are interested in.

You can also click Expand All () and Collapse All () in the Browser options.

The set of actions applied to applications is different from those applied to UI controls.

Window Commands

UI Control Commands

  • Activate
  • Type
  • Press keys
  • Maximize/minimize
  • Close/kill

  • Focus
  • Move mouse
  • Click/double-click/right-click
  • Type/set text
  • Press keys

Inspecting Windows

Available from RPA Express 2.3.0.

You can also create custom window selectors and assess them against all open windows. On the Applications and Windows screen, click on a needed window to get its selector.

Tip

The inspecting procedure is the same as for UI controls.


Testing Selectors

Before putting a selector to bot task configuration, it is recommended to test if it works correctly. To do that, search for the UI control matching the given selector.

  1. Copy your selector into the Selector field and press Enter.

  2. If the selector exists, Inspector finds the corresponding window control and selects it in Browser with detailed information in Result List. The target control is highlighted in the application.

Inspector performs a check for selector uniqueness and supports collections of selectors corresponding to the search criteria. If there is more than one selector with the same attributes in the search results, switch between selectors by clicking the Back and Forward arrows until you find the needed selector.

Available since RPA Express 2.2.0.

Useful Tips

Mind to open the application the selector belongs to, as the search is performed among UI controls of the selected application. Otherwise, the selector will not match any components.

If you still cannot find your selector, make sure you copied it correctly. Also, the Instance and Text attributes may facilitate the search.

Applying Selectors

As soon as the target component is found and tested, you can copy it to WorkFusion Studio for further usage either in Record or Code perspectives.

Copying to Record Perspective (UI Control)

  1. Press Ctrl + A to select your unique object selector.
  2. Press Ctrl + C to copy.
  3. Open your recording in Record perspective, select an action from Actions Library and add it to Actions Flow.

  4. In the action properties window, select Target > Window control > Selector and press Ctrl + V.

    The unique object selector value can be used for Selector of the Click Mouse action.



    The action is assigned to a specific control in the application.

Copying to Record Perspective (Window)

  1. Press Ctrl + A to select your unique object selector.
  2. Press Ctrl + C to copy.
  3. To use the window selector, add the Window action to your actions flow.
  4. Select Enter window selector (from Inspector) and paste (Ctrl + V) the copied selector into the field.

    Tip

    Mind that you can access Inspector directly on the Window action screen by clicking Open Inspector to get window selector.

Copying to Code Perspective

To copy a selector to bot task configuration, switch to Code perspective and paste your selector into the code.

Getting Value From Field in Windows Application

There are two ways of getting a value from a window control.

Before you start to use selectors in the recording, keep in mind to switch to the target application with the help of the Window action.

Way 1

  1. Create a recorder variable of type String
  2. Open Inspector and find a selector of the necessary field in the application.
  3. Apply the Click Mouse action > Window control.

  4. Use the Enter Keystrokes (Ctrl + C) action to copy the value from the field (if needed, use Enter Keystrokes (Ctrl + A) before).
  5. Use the Clipboard action to set the copied value into your variable.

Way 2

  1. Create a recorder variable of type String
  2. Open Inspector and find a selector of the necessary field in the application.
  3. To get the text from the field, use the Script action with the code as in the example below.

See a custom script on how to get an object value in Code Samples.

Special Cases

Inspecting Office 365 Applications

Special attention should be paid when retrieving selectors of UI controls related to Office 365 applications. After Microsoft software updates, attribute values may change, and selectors previously used in your scripts will not be unique or stop working at all.

Thus, Excel cell selectors differ in various versions of Microsoft Office 365.

Previous version of Microsoft Excel
[CLASS:DataItem; NAME:A1]
Newer version of Microsoft Excel
[CLASS:DataItem; NAME:"A" 1]

Be careful with the selectors related to UI controls of Office 365 applications, as Microsoft software updates can change selector values. To be on the safe side, it is recommended either to reinspect UI controls, or to use Recorder for Excel actions and other Office 365 related actions.

Focusing on Hidden Elements

Available from RPA Express 2.3.0

If a UI control is collapsed and cannot be visible on the application screen, you can easily expand it to get a selector. It is especially useful when inspecting complex trees or tabs. To open a collapsible UI control, do as follows.

  1. Right click on any hidden element within the tree and select Focus.

  2. On expanding the element, copy its selector to use in your actions flow.

You can also activate a hidden element using the focus() method in your script$('tree_hidden_element_selector').focus().

  • No labels