puppeteer get value of div
await page.waitForSelector('your selector')
let element = await page.$('your selector')
let value = await page.evaluate(el => el.textContent, element)
puppeteer get value of div
await page.waitForSelector('your selector')
let element = await page.$('your selector')
let value = await page.evaluate(el => el.textContent, element)
get element text puppeteer
const puppeteer = require('puppeteer');
describe('My First Puppeteer Test', () => {
it('should launch the browser', async function() {
const browser = await puppeteer.launch({
headless: false,
slowMo: 50,
devtools: false,
});
const page = await browser.newPage();
await page.goto('http://example.com/');
const title = await page.title();
const url = await page.url();
const text = await page.$eval('h1', element => element.textContent)
console.log('Text in the H1: ' + text);
await browser.close();
})
})
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us