How do I console log the text inside of html element?

Viewed 436
2 Answers

Try

(async () =>{
   const { data } = await axios.get(productUrl);
   const $ = cheerio.load(data)
   const title = $('h1');
   console.log(title.text());
   
})();

Try changing line 3 to const $ = await cheerio.load(data)

Related