Skip to content

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

ParameterTypeDescription
targetstringThe visible text to count, or target elements — by CSS or XPath selector
expectedCountnumberThe 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.