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.

It's benefit to support ElementHandle.waitForSelector method

See original GitHub issue

In browser, we can use querySelector method like this:

const div = document.querySelector('div');  // lookup "div" globally
const span = div.querySelector('span');  // lookup "span" locally, that is bounded to div's scope

It’s helpful to provide waitForSelector method on ElementHandle, thus we can wait for selector locally that is bounded to the ElementHandle instance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
tanvee38commented, Apr 6, 2018

Great work by JoelEinbinder and aslushnikov. Eagerly waiting to see the waitFor* functions support to wait for elementHandle in the next Puppeteer release.

4reactions
JoelEinbindercommented, Jan 5, 2018

With 05b1aca21e5c2f221373d601d3b8ae6b2a984292 you should be able to do something like this.

Warning, untested code ahead:

function waitForScopedSelector(selector, scopeElement) {
    return page.waitForFunction((selector, scopeElement) => scopeElement.querySelector(selector), {}, selector, scopeElement);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

It's benefit to support ElementHandle.waitForSelector method
It's helpful to provide waitForSelector method on ElementHandle, thus we can wait for selector locally that is bounded to the ElementHandle ...
Read more >
ElementHandle.waitForSelector() method - Puppeteer
Wait for an element matching the given selector to appear in the current element. Unlike Frame.waitForSelector(), this method does not work across navigations...
Read more >
Migrating from Puppeteer to Playwright - DEV Community ‍ ‍
The switch from Puppeteer to Playwright is easy. But is it worth it? And how exactly does one migrate existing scripts from one...
Read more >
Puppeteer waitForSelector - tools4testing
waitForSelector method returns the promise with element handle which is represented by the selector expression and null if element is not found after...
Read more >
Puppeteer - Quick Guide - Tutorialspoint
To identify it using the ElementHandle method on the page, the expression should be as ... Puppeteer supports headless execution and hence it...
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