API …
Locators & DOM

Dynamic IDs & classes

Every render generates new ids and class names. Learn selectors that survive: text, role, data attributes and structure.

Practice tasks

  • Reload and show the id of the button changed.
  • Click it using getByRole and a stable data attribute.
  • Write an XPath that ignores the random suffix (starts-with).
  • Explain why recording tools break here.

More Locators & DOM practice