user15237617
user15237617

Reputation:

Using innerText without async in puppeteer

i was creating a certain code of puppeteer ,and i wanted to know if there's a way to get innertext or innerHtml or textcontent while using puppeteer without an async function.

Upvotes: 0

Views: 206

Answers (1)

tionsys
tionsys

Reputation: 181

You can use await to use an async function in a synchron way.
Please note that this does not only apply to puppeteer, but javascript in general.

var text = await page.evaluate(() =>
   document.querySelector('#example').innerHTML
);

Upvotes: 1

Related Questions