To wait until an element is visible with JavaScript Puppeteer, we call waitForSelector
.
For instance, we write
const puppeteer = require("puppeteer");
const broswer = await puppeteer.launch();
const page = await browser.newPage();
await page.waitForSelector("#myId");
browser.close();
to call launch
to launch the browser.
We call awaitForSelector
to wait for the element with ID myId to show.