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] });
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!