-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Waiting for a selector with a specific index #4995
Comments
The following snippet should get it: const span = (await page.$$('span'))[1]; |
Thanks, however this is not precisely what I'm looking for. I want to wait for this element with index 1 to appear, similar to |
Why not use |
I snooped through some PRs and found that what I'm requesting was removed in #4640, though I'm unsure why. |
We are working on the index selector, see issue #3697. |
@dgozman great, I'm excited to see that this is being worked on For now, I accomplish it by continuously querying until it is found or timing out. It's a hacky approach that I would prefer to avoid, but do I have any better options for now? |
Given a page with the following code
What is the best way to access the 2nd span element with Playwright? The css selector
nth-of-type
is not what I'm looking for - I just want the 2nd instance of span in a generic way.The text was updated successfully, but these errors were encountered: