Web selectors
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:
-
ID
The element's ID is defined by theid
HTML attribute. -
Name
The element's name is defined by thename
HTML attribute. -
CSS
The CSS selector to identify the element. -
Link text
The anchor hyperlink reference is defined by thehref
HTML attribute. -
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'sinnerText
Javascript attribute. -
XPath
The XML Path selector to identify the element. -
Class and value
The element's class and value. The class is defined by theclass
HTML attribute, and the value is defined by thevalue
HTML attribute. -
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.
Important:
- 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.
-
Using the DevTools
You can leverage the embedded browser's developer tools during your script development. -
Manually copying selectors in the browser
Learn how to manually get selectors to reference web page elements.