Selectors are mechanisms that are used to locate and interact with elements in a graphical user interface (GUI) application. These elements often referred to as controls can be anything from windows to buttons to combination boxes.
Selectors use the element's inner attributes to identify the element. In a web page, elements are the HTML tags that compose the web page, and the element's inner attributes are the HTML attributes defined in the element, like classes, IDs, and the HTML tag name.
For example, the following HTML element has an ID that you could use as a selector:
<div id="demo"> <p>Something here...</p> </div>
When building a script with IBM Robotic Process Automation, you have access to the following web selector options:
The element's ID is defined by the
The element's name is defined by the
The CSS selector to identify the element.
The anchor hyperlink reference is defined by the
Inner text and control type
The element's inner text and the element's tag name. The inner text is the text defined in the element's
The XML Path selector to identify the element.
Class and value
The element's class and value. The class is defined by the
classHTML attribute, and the value is defined by the
Name and value
The combination of the element's name and value selectors.
ID and name
The combination of the element's ID and name selectors.
- Always use selectors that reference only one element, such as the identifier selector (IDs).
- If you find dynamic IDs on the inspected page or web application, for example:
<input type="text" id="uid-8sad54-7fda">, give preference to using the CSS selector.
- To learn more about elements and selectors, see Controls and selectors overview.
You can create selectors manually or using the web recorder. See more information in Manually copying selectors in the browser and Recording web applications.