Selectors

Selectors are a combination of one or more attributes that are used in IBM Robotic Process Automation to identify GUI controls. You can see the attributes of an application’s control by mapping them using the recorder in IBM RPA Studio.

GUI controls

Use selectors that uniquely identify the control. In an application, some attributes are unique to a control, while others might appear in multiple controls. The combination of multiple attributes can generate a selector that uniquely identifies a control.

Controls combination

Common control attributes used as selectors are the control ID, the control name, path in the application's element tree, called XPath, class, and the window title.

In IBM RPA, selectors can fall under one of two categories: window selectors and control or element selectors.

Windows selectors

Window selectors identify windows in a GUI application. IBM Robotic Process Automation uses window selectors to attach windows to the automation context, so that IBM RPA can interact with the window's internal controls.

Window

The available selectors are:

  • Title
    The window title. Usually, windows have a title that is identified as a label, which allows IBM RPA to consider the title as a string literal or a regular expression pattern.

  • Identifier
    The window's unique ID.

  • Class name
    The name of the class that instantiates the window.

  • Process ID
    The process identifier number generated by Microsoft Windows™ when you start the application.

  • Process name
    The name of the process identified by Windows when the application is started.

  • Style
    The style refers to whether the window is a child window or a standard Windows dialog window.

  • Minimum height
    The size in pixels of the minimum expected height for the window. Windows that have a height greater than the selected minimum are considered as possible candidates for the selection.

  • Minimum width
    The size in pixels of the minimum width expected for the window. Windows that have a width greater than the selected minimum are considered as possible candidates for the selection.

Control selectors

The control selectors reference the internal controls of a window.

In IBM Robotic Process Automation, you can use the following selectors:

  • ID
    The control's unique identifier. Some applications generate IDs dynamically, which means that it changes every time that you run the program. Keep in mind that the recorder can only store the current selector values, and it cannot be used to predict dynamic values. If you encounter an application that uses dynamic IDs, use another type of selector in your script.

  • Name
    The name of the control. Name is an attribute that is usually created by the application developer and cannot be a unique attribute to the control.

  • Inner text and control type
    The combination of the inner text and control type attributes. Inner text is the text that a control displays, and the control type is the object that defines a control. In Web applications, the control type is the HTML tag of the control, and the inner text is the text that the innerText attribute defines. In Windows applications, the control type is the instantiated object, such as a Button, and the inner text is the text that the control displays.

  • XPath
    XPath stands for XML Path Language. Applications are sets of hierarchical controls within a window. This set can be expressed as nodes in XML. In Web applications, this set is the DOM. In Windows and SAP applications, the control type tree within the window represents this set. The XPath selector is the path through the control tree to the target control. XPath must be the selector to reference controls in Java applications.

  • Class and value
    The combination of attributes: class, which is the class that instantiates the control, and value, which is the value that the control stores. This selector is only valid if the control stores values.

  • Name and value
    The combination of attributes: name and value. This selector is only valid if the control stores values.

  • ID and name
    The combination of attributes: ID and name.

  • Class name
    The name of the class that instantiates the control.

  • Type and index
    The control type and the index of its position among controls of equal type. The control type depends on which class was used for its instantiation; the index is the position, with 0 being the first control among equal types.

  • Type and name
    The combination of attributes: control type and name.

  • Vision
    The mapped image that identifies the control. When Vision is used, the bot searches the screen for the image that is defined as the selector for interaction. Used in surface automation.

  • Instance
    The control instance. The Search Control (searchControl) command stores control instances in instance variables. You can reference these variables whenever you need to.

  • Search Control
    Combination of any attributes as selectors, whereas other commands have a list of predefined selectors. Search Control returns a control instance.