'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.



Solution 1:[1]

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
);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tionsys