How-to
Binding a Target from the object repository
Binding a Target from the object repository
Binding a Target from the object repository attaches a saved page or element to a step so you do not copy the locator or path into every autotest. When the catalog has no entry, set Target with an on-step locator instead.
Prerequisites
- An autotest card is open with a step where Target is required or allowed.
- The needed record exists in the object repository, or you are ready to set a locator on the step.
- For Value source
TEST_ACCOUNTon the same step, Target must not be a repository page.
Steps: element as Target
- Open the step and find the Target field.
- Choose an element from the object repository (kind
ELEMENT). - Confirm the element locator fits the action (
click,fill,toBeVisible, and other actions that require Target). - Fill Value per the action rules; the source may be
INLINEorTEST_ACCOUNTwhen the action allows it. - Save the step.
The step references one catalog element. Changing the element locator updates every step bound to it.
Steps: page as Target
- Open a step where Target is a path or page (per scenario meaning and action rules).
- Choose a page from the object repository (kind
PAGE). - Do not set Value source to
TEST_ACCOUNTon this step: the combination is forbidden. - Save the step.
A page provides a reusable path. For goto, waitForURL, and toHaveURL, pick a catalog page: the step form clears Value and substitutes the record path. A relative path joins the run starting domain. Store a screen on a team subdomain as a full URL on the page card.
Steps: on-step locator (no catalog)
- In Target, choose the on-step locator mode (not a repository record).
- Set
kind:ROLE,LABEL,PLACEHOLDER,TESTID,TEXT,CSS,ID,NAME,XPATH, orSELECTOR. Do not confuseLABEL(field label) withTEXT(visible text): Autotest step. - Set the locator value. For
ROLE, add the accessible name when needed (name/ accessible name). - Save the step.
The locator lives only on this step. Prefer an object-repository element for repeated targets.
When to use which
| Option | When |
|---|---|
| Repository element | The same control appears in several autotests |
| Repository page | A shared page path without duplicating the string in steps |
| On-step locator | A one-off Target or a draft before catalog entry |
Examples
Repository element by label + fill
UI fields:
| Field | Value |
|---|---|
action_name | fill |
| Target | repository element «Email field» |
| Value | login |
| value_source_type | TEST_ACCOUNT |
| value_source_field | login |
JSON fragment (illustration; substitute your element id):
{
"action_name": "fill",
"target": { "repository_element_id": "elem_email" },
"value_text": "login",
"value_source_type": "TEST_ACCOUNT",
"value_source_field": "login"
}On-step locator without the repository
{
"action_name": "click",
"target": { "kind": "ROLE", "value": "button", "name": "Save" }
}Forbidden: TEST_ACCOUNT + page
Do not save a step where Value comes from TEST_ACCOUNT and Target is a repository page. Choose an element or locator, or switch the source to INLINE.
Did this page help?