import { ElementHandle } from "https://dotland.deno.dev/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/types.d.ts";
Wait for an element matching the given selector to appear in the current element.
Unlike {@link Frame.waitForSelector}, this method does not work across navigations or if the element is detached from DOM.
Examples
Example 1
Example 1
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
let currentURL;
page
.mainFrame()
.waitForSelector('img')
.then(() => console.log('First URL with image: ' + currentURL));
for (currentURL of [
'https://example.com',
'https://google.com',
'https://bbc.com',
]) {
await page.goto(currentURL);
}
await browser.close();
})();