Best Practices for Screen Elements
This topic provides best practices to apply when working with screen elements.
For help on working with screen elements, see Screen Elements.
Editing Screen Elements
-
Select as few recognition properties as possible for each screen element.
-
For web applications, the recommended recognition properties to use are listed below in descending order of preference:
-
ID
-
Selectors
-
XPath
-
-
Give each captured screen element a meaningful name. In many cases it is also useful to modify the names of screen elements higher in the hierarchy. For example, if you capture an element from a web page, it is recommended to rename the HTML Document element above it with a meaningful name too.
-
The recommended naming convention for a screen element is Upper CamelCase, for example, SearchButton and FirstNameField.
-
It is often useful to include descriptors of the screen element's type and location, for example, using a convention of <Page Name><Control Type><Name>, for example:
-
Payment.TextBox.Street (or Payment.txt.Street)
-
Account.ComboBox.Country (or Account.cmb.Country)
-
-
After capturing a screen element, close the application, reopen it, and locate the screen element again to ensure that the identification properties set are reliable. In some cases, the values of the identification properties differ each time the application is opened. This is particularly true for web applications.
Capturing Screen Elements from Browsers
To help you and others identify captured screen elements in the Asset Tree, you should rename elements in the hierarchy as follows:
-
Rename the captured screen element with a meaningful name
-
Rename the HTML document with a meaningful name
-
Rename the top screen element under the process with the application name
Make sure that only the elements listed above are set to Available for Use.
For example, after capturing the search bar at https://www.nice.com/
the indicated elements should be renamed as shown. These should be the only elements visible in the Asset Tree.
Follow the guidelines below when selecting recognition properties for each screen element in the hierarchy:
-
Select as few recognition properties as possible.
-
The order of preference for recognition properties is:
-
ID
-
Selectors
-
XPath
-
All other properties
-
If the XPath is larger than five objects, look for anchor elements using the Web analyzers. If you must use XPath or selectors:
-
Select an anchor element as close to the captured element as possible.
-
XPath only needs to be defined up to the anchor element. Fewer elements between the anchor and the captured element result in a more stable capture.
-
Look for a parent non-visible element with a name or ID tag to use as an anchor. DIV elements are good candidates for anchors.
Capturing data from tables can be difficult, unless you only need to capture data from a specific cell that has a constant position. In other cases, you may need to use HTML Table screen elements.
To do so, manually set the identification properties for the HTML Table screen element. Use Developer mode to find the table you need in the HTML document, and then manually create the table screen element using the properties from the table element.
For an example project, see Process Tables.
Handling Dynamic Documents
-
Only enable the Dynamic Document option for HTML Document elements if the web page's contents update dynamically. Do not select this option unnecessarily as the frequent scanning of a web site slows performance.
Capturing Screen Elements Using Multiple Connectors
Some automation solutions need to interact with applications for which different connectors are provided. For example, a solution might have to interact with a web app delivered through Chrome (using the Chrome connector) and with an SAP application (using the SAP connector).
Best practice is to create one project per connector used. Continuing the example above, you would create one project for the automation of processes that use the screen elements captured with the Chrome connector, and another project for the automation of processes that use the screen elements captured with the SAP connector. The projects can interact with each other to provide a total solution, for example, using packages, or by invoking robotic workflows.
Using Screen Elements in Workflows
For best practices on how to interact with screen elements in a workflow, see here.
Managing Screen Element Recognition
For best practices on enabling and disabling screen element recognition, see here.