How-to

Id assert (toHaveId)

Id assert (toHaveId) ​

Expect assertion: the Target id attribute equals Value.

Step model ​

action_nametoHaveId
GroupExpect
TargetRequired
ValueRequired (dom_id)
expected_valueUnused
TEST_ACCOUNTAllowed
Do not confuse withtoHaveAttribute

Target/Value facts match the source-of-truth catalog and Autotest step.

Prerequisites ​

  1. The element has a stable id.

Steps ​

  1. Add a toHaveId step.
  2. Set Target.
  3. Enter the id in Value.
  4. Save.

The step is stored on the autotest. Next - neighbouring steps or autotest run creation.

Examples ​

Checkout form ​

Fields in the UI:

FieldValue
action_nametoHaveId
Targetkind ROLE, value form
Valuecheckout
value_source_typeINLINE

Step JSON fragment (copy-paste):

json
{
  "action_name": "toHaveId",
  "target": {
    "kind": "ROLE",
    "value": "form"
  },
  "value_text": "checkout",
  "value_source_type": "INLINE"
}

Common mistakes ​

  • Do not use this assert to find the element. To find it, set a Target of kind ID. toHaveId checks an element that is already located.

Screenshots ​

Screenshots of the step form for toHaveId will be added here in a later pass.

Version 1.0.0 · Last updated 2026-10-03

Did this page help?