Appearance
I.count()
Asserts the number of visible text occurrences or visible elements on the page.
If the actual count does not match the expected value, the assertion fails and the test will fail.
Usage
js
I.count(target: string, expectedCount: number)Parameters
| Parameter | Type | Description |
|---|---|---|
target | string | The visible text to count, or target elements — by CSS or XPath selector |
expectedCount | number | The expected number of visible occurrences. |
Examples
js
I.count("Error", 3)In this example, the test verifies that the visible text "Error" appears exactly 3 times on the page.
js
I.count(".order-items tr", 5)In this example, the test verifies that there are 5 visible table rows inside the .order-items table.