I am looking for a method to instruct Puppeteer to pause execution until a specific element appears on the page. For example, I want to ensure visibility for the next button before clicking it. Here is an example structure I envision:
const validateButton = await page.$('input[value=validate]');
await validateButton.click();
// I need a function that does something similar to this:
await checkElementVisibility('.btnNext');
const nextButton = await page.$('.btnNext');
await nextButton.click();
Can someone guide me on how to effectively implement this?