Skip to content
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

add ElementHandle.parentElement #38

Open
sigmaSd opened this issue Oct 29, 2023 · 3 comments
Open

add ElementHandle.parentElement #38

sigmaSd opened this issue Oct 29, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@sigmaSd
Copy link
Contributor

sigmaSd commented Oct 29, 2023

Is it expected to add such apis, I use them frequently like this
ElementHandle.parentElement.children[1] for example

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Oct 29, 2023

puppetter also doesn't have this, seems the way to do this is with https://pptr.dev/api/puppeteer.page.evaluatehandle

@lino-levan
Copy link
Owner

ElementHandle.parentElement.children[1]

The API as written is not technically feasible. At best (with the current API), it could be

await(await ElementHandle.parentElement()).children()[1]

we will be moving to locators soon, which solve this problem. With locators you could just do

Locator.parentElement.children[1]

and it could just work. TLDR; This is dependent on #2

@lino-levan lino-levan added the enhancement New feature or request label Mar 2, 2024
@sigmaSd
Copy link
Contributor Author

sigmaSd commented Aug 22, 2024

This trick works in puppeteer https://stackoverflow.com/a/66435477/6900891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants