Skip to content

docs: clarify that locator.nth is zero based#7326

Merged
sheremet-va merged 1 commit intomainfrom
docs/clarify-locator-nth-is-zero-based
Jan 21, 2025
Merged

docs: clarify that locator.nth is zero based#7326
sheremet-va merged 1 commit intomainfrom
docs/clarify-locator-nth-is-zero-based

Conversation

@patak-cat
Copy link
Copy Markdown
Member

Description

Add a note as Playwright has in their docs for nth.

I think that nth() should start from 1, in the same way that CSS :nth-child and usage in JS like nthCalledWith. I thought of adding an at() alias to avoid confusion, but I think aligning with playwright locators is more important here. Maybe the alias could first be proposed to Playwright, but I doubt they will be willing to change this.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 21, 2025

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit e88a522
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/678f9b2b8e8b3600085e87a1
😎 Deploy Preview https://deploy-preview-7326--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sheremet-va
Copy link
Copy Markdown
Member

Maybe the alias could first be proposed to Playwright, but I doubt they will be willing to change this.

We don't depend on Playwright, we can build our own locators.

@sheremet-va sheremet-va merged commit 9745fe8 into main Jan 21, 2025
@sheremet-va sheremet-va deleted the docs/clarify-locator-nth-is-zero-based branch January 21, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants