[Feature] Pass Locator into page.waitForFunction to wait custom condition
See original GitHub issueProvide 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:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top 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 >
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 Free
Top 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
@dgozman How about create something more generate methods? Like
await page.waitUntil(function(), options)
andwaitUntil
will waitfunction
returntrue
, and pool it eachtimeout
fromoptions
object Does it make sense? Full example:await page.waitUntil(async(el) => { return await locator.innerText() === 'Apply button'}, {pool: 100})
Playwright v1.21 will have this: https://playwright.dev/docs/next/test-assertions#polling