Unable to get element childNodes/children
See original GitHub issuevar listSelector = "#list"
var listElement = await page.$(listSelector);
var listChildren = await page.evaluateHandle(e => e.children, listElement);
// listChildren is null here
I’ve tried dozens of other ways, including using elementHandle.getProperties
as described here, and I can’t get a list of children.
My end goal is to get a list, iterate through all the children, and then click on one of the children based on its text. I can do the text clicking part, but I’m having a heck of a time getting node children.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:8 (2 by maintainers)
Top Results From Across the Web
can't access child node's value but i ...
Actually nodeType 1 is an HTML element, i.e. div, span etc and an element doesn't has any nodeValue instead it could contain child...
Read more >Node.childNodes - Web APIs - MDN Web Docs
To get a collection containing only elements, use Element.children instead. Value. A live NodeList containing the children of the node. Note: ...
Read more >Element (jsoup Java HTML Parser 1.15.3 API)
A HTML element consists of a tag name, attributes, and child nodes (including text ... Get the number of child nodes of this...
Read more >Parsing XML to get child nodes - apex
querySelectorAll function, XmlNode.getChildElement() and so on doesn't recursively find child elements. <UpdateResponse> isn't the immediate ...
Read more >Locating child nodes of WebElements in selenium.
First of all we need to identify the parent element with help of any of the locators like id, class, name, xpath or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A bit late, but just in case it’s still useful or someone comes here from Google. You can use the ‘:scope’ selector.
To iterate over children, you have at least 2 options: 1) transfer all the iteration logic to the browser context and get the final data; 2) get an array of JSHandles to iterate over it: