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.

[Feature] Pass Locator into page.waitForFunction to wait custom condition

See original GitHub issue

Provide possible to pass Locator into page.waitForFunction function to wait custom condition on page Example: await page.waitForFunction(async (loc: Locator) => { return await loc.isVisible() === false }, locator, { timeout: this.timeout })

In general it possible replace eval/evaluate functionality and be more clear for people who migrate from other frameworks and programming languages.

For example simple way to understand released in WDIO7 https://webdriver.io/docs/api/browser/waitUntil

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AndreyMelnichenkocommented, Dec 7, 2021

@dgozman How about create something more generate methods? Like await page.waitUntil(function(), options) and waitUntil will wait function return true, and pool it each timeout from options object Does it make sense? Full example: await page.waitUntil(async(el) => { return await locator.innerText() === 'Apply button'}, {pool: 100})

0reactions
pavelfeldmancommented, Apr 6, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Page.waitForFunction() method - Puppeteer
To pass arguments from node.js to the predicate of Page.waitForFunction() function: const selector = '.foo'; await page.waitForFunction(
Read more >
How to wait for JavaScript to finish in playwright - Stack Overflow
Probably page.waitForFunction is the most versatile, because you can pass a custom function that waits for a specific condition to be met.
Read more >
WaitFor an Element | Playwright Tutorial - Part 78 - YouTube
In this video, let's understand how to use the waitfor function.Returns when element specified by locator satisfies the state option.
Read more >
Avoiding hard waits in Playwright and Puppeteer
We try to solve this issue with a hard wait, like Puppeteer's page.waitFor(timeout) . This could looks something like the following: await page....
Read more >
How To Use JavaScript Wait Function In Selenium WebDriver
Using the JavaScript Wait function, you can pause your test execution until a certain condition is met. In this article, you're going to ......
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