An Element in test automation refers to a UI field or control on the page that you are attempting to interact with or verify.
When it comes to web applications, ACCELQ offers two distinct Locator Options for Element identification:
- Smart Locator
This method utilizes an AI-driven algorithm to find functionally meaningful textual information that can be related to an Element on the screen you are trying to interact with. There is no locator that needs to be stored or maintained.
This textual information (called 'hint') may or may not be visually displayed on the screen. For a given Element, you can view this locator-free hint by hovering over the element in the Recorder.
Automation statements refer to this hint to identify the element to interact with.
For example, in the statement below, "qbankadmin" is entered in a field whose label (hint) is "Username".
Test logic becomes more resilient to the changes in the application's DOM structure and the underlying HTML code.
Since the locator text for an element is embedded in the Action logic statement directly, there is no need to manage it externally. These elements are not listed in the Element Repository.
Learn more about Locator-free automation.
This method employs an intelligent approach to construct a unique ID for an element using a stable combination of available HTML attributes.
When using Smart Locators, each Element has a logical name with which it is referred in the statements in your Action logic. These Elements are stored in the Element Repository.
For example, in the following statement, "qbankadmin" is entered in an input field whose reference name is "Username Web Input", which in turn is managed in the Element Repository.
Learn more about Smart Locators.
Managing default Locator Option for logic development
When creating statements from the Recorder, by default, ACCELQ uses the Locator-free approach wherever feasible.
This behavior can be managed from the Resources > Project Preferences
Note about default preference:
- When an element already exists as a Smart Locator in the Repository, statements are always created with Smart Locator no matter what the default setting is.
- When the Locator-free approach does not yield a meaningful or reliable hint, Smart-Locator is used regardless of the default setting.
Manually selecting the Locator Option
When recording or inserting a statement, you can manually access the two locator options for element identification by clicking the [L/O] tag on the right side of the command name in the Recorder, or in the logic editor command search results, against a given command.