Answer the question
In order to leave comments, you need to log in
How is it possible to parse text from a span tag?
There is a span tag with the aria-label attribute, I have been trying to parse the text from this attribute for a day now, it returns either an object or a string but not the text "Load more comments"))) please help with the code, what's wrong? I will be very grateful to the person who can help me solve this problem.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch(/*{headless: false}*/);
const page = await browser.newPage();
await page.goto('https://www.instagram.com/p/B7OCywQF4Yu/');
await page.waitForSelector('span[aria-label="Load more comments"]');
try
{
const x = page.$eval('span[aria-label="Load more comments"]',erw=>erw.innerHTML)
console.info( x);
}
catch(err)
{
console.log(err)
}
await browser.close();
})();
Answer the question
In order to leave comments, you need to log in
erw=>erw.innerHTML
might be better than
erw=>erw.text
and not bother with tags? ;)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question