vendredi 4 juin 2021

ReferenceError: document is not defined for easy JavaScript

I have a method that stores the title of an articel in an Json but the problem is hat a => a.textContent shows "\n title " of h1. if i use innerText it gives me empty String.

const heading = await page.$eval(".boxedarticle--title", h1 => h1.textContent);

I read that var text = "textContent" in document ? "textContent" : "innerText"; document.title = document.getElementsByTagName("h1")[0][text] should solve it but then i get the error message ReferenceError: document is not defined

Aucun commentaire:

Enregistrer un commentaire