# Locator Inventory — <flow name>

App: <base URL>        Author: <you>        Date: <date>

Verify every row in DevTools before it enters the inventory:
  CSS:    $$("selector").length      → must be 1 for "the element"
  XPath:  $x("//expression").length

| Page | Element | Locator | Type | Matches | Notes |
|------|---------|---------|------|---------|-------|
| Login | username field | #user-name | CSS | 1 | |
| Login | password field | #password | CSS | 1 | |
| Login | login button | #login-button | CSS | 1 | |
| Login | error message | [data-test='error'] | CSS | 1 | only after failed login |
|  |  |  |  |  | |
|  |  |  |  |  | |

Priority when several locators match the same element:
  id  >  data-test attribute  >  meaningful class/attribute  >  hierarchy  >  position (last resort)

Red flags (fix before coding):
  [ ] Any locator matching more than 1 element
  [ ] Any absolute XPath (/html/body/div[1]/...)
  [ ] Any :nth-child / index-based locator that has a better alternative
  [ ] Elements with no id and no data-test → consider asking developers to add one
