(page: Page)
| 428 | |
| 429 | |
| 430 | def test_locators_should_respect_nth(page: Page) -> None: |
| 431 | page.set_content( |
| 432 | """ |
| 433 | <section> |
| 434 | <div><p>A</p></div> |
| 435 | <div><p>A</p><p>A</p></div> |
| 436 | <div><p>A</p><p>A</p><p>A</p></div> |
| 437 | </section>""" |
| 438 | ) |
| 439 | assert page.locator("div >> p").nth(0).count() == 1 |
| 440 | assert page.locator("div").nth(1).locator("p").count() == 2 |
| 441 | assert page.locator("div").nth(2).locator("p").count() == 3 |
| 442 | |
| 443 | |
| 444 | def test_locators_should_throw_on_capture_without_nth(page: Page) -> None: |
nothing calls this directly
no test coverage detected