question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update on iterating over page.$(selector)?

See original GitHub issue

I was reading over #303 and #382, but did not see any update on how to console.log() all selectors on a page. Maybe an simple example on this issue or in the docs would be helpful.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aslushnikovcommented, Jan 12, 2018

@alexhallam like @vonGameTheory said, you can use page.$$ to get ELementHandles for all the DOM elements

const allNodes = await page.$$('*');

Hope this helps.

1reaction
jamesthrosbycommented, Nov 22, 2017

Are you looking for something along the following lines? const selectors = await page.$$(SELECTOR); selectors.forEach( (element) => { console.log(element); });

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer iterating through elementHandles from page ...
I have tried the following code which prints it successfully, but that's still not what I'd want. const selectors = await page.$$('# ...
Read more >
Iterating through List to Update - Salesforce Stack Exchange
Currently I'm pulling through a list of records from a VisualForce/Apex Page. What I'm trying to do is iterate through this list and...
Read more >
In an update script iterating over a large WQL (WPC query ...
Problem. If in a script you iterate over a large WQL resultset (more than 1000 items) to update an attribute which is actually...
Read more >
Modify a list while iterating over it in Python | bobbyhadz
To modify a list while iterating over it, use a `for` loop to iterate over a copy of the list. On each iteration,...
Read more >
Iterate Over Selected Elements - JavaScript Tutorial
To iterate over the selected elements, you can use forEach() method (supported by most modern web browsers, not IE) or just use the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found