☰ See All Chapters |
Puppeteer ElementHandle
ElementHandle instances are created by page.$, page.$$, page.$x methods. ElementHandle instances represents element or tag in html page.
const puppeteer = require('puppeteer'); async function example() { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://www.registration.tools4testing.com/'); const element = await page.$("#loginopener"); element.click(); await browser.close(); } example(); |
elementHandle .$, elementHandle.$$, elementHandle.$x methods can again be used on elementHandle. In this case element will be searched inside the dom the current elementHandle is representing and element will be not searched from entire page dom.
All Chapters