Back to all steps

Check element count

Step fields
1 selector (text)
2 count (number)
In a scenario, fields are joined with |.
Assert the number of matching elements. Format: selector|count.
Example: .product-card|12 — exactly 12 product cards on the page
Usage example

Check that the page has exactly N elements matching the selector.

Format: selector|count

Examples:

  • .product-card|12 — exactly 12 product cards
  • tr.row|0 — the list is empty
  • nav a|5 — 5 links in the menu