Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
Puppeteer reload page until element is available

i'm using puppeteer and i need to keep refreshing the page until the requested element is live, "button" is the element i need. i tried with the wait until but it is not working and gives me this error:

Error: Unknown value for options.waitUntil: JSHandle@node

This is what i tried

const [button] = await page.$x("//a[contains(., 'Denim')]");
    if (button) {
    await button.click();
    }
    
    await page.reload({ waitUntil: ["networkidle0", "domcontentloaded", button] });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The error is pretty explicit in this case. You are telling puppeteer to wait for these 3 things: ["networkidle0", "domcontentloaded", button]. The first 2 are acceptable options. The 3rd is not. button is a reference to a DOM element which you can use in your puppeteer code. (Or a JSHandle@node). As per the docs, this is not a viable option.

Just another point here: you don't share all your code so we must assume that this is happening in some sort of loop with some sort of timeout between calls. As is, this code will check for this button, click the button if found, and then reload the page exactly 1 time. Reload does not reload the page multiple times while searching for some feedback. It just reloads once. The waitUntil option just defines when the returned promise should resolve.

Good luck!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!