So I am trying to get the innertext from a class like in the dev console:
document.getElementsByClassName('title')[0].innerText
but I am trying to get it automated in purppeteer. I have been looking for an answer for 2 days, and the answer is probably pretty easy, I just can't seem to find a working easy answer.
Thank you for any help!
You can get to the dev console with the page.evaluate()
. This should work for you:
let text = await page.evaluate(() => {
return document.getElementsByClassName('title')[0].innerText;
});