2

I tried cheerio to find the element and if the element is found then he has to click but I don't know what to do with the puppeteer combination, the button I want to click is in the 3rd pict

    await page.waitForTimeout(10000)
    const contentHTML = await page.content();
    const $ = cheerio.load(contentHTML);
    const outerHTML = $('<button class="sc-nkuzb1-0 sc-d5trka-0 dsOMxw button" data-theme="home.verifyButton">Authenticate</button>').prop('innerText');  
    console.log(outerHTML);

enter image description here

enter image description here

  • 1
    See [Pass Cheerio element to Puppeteer to have it clicked](https://stackoverflow.com/questions/64928487/pass-cheerio-element-to-puppeteer-to-have-it-clicked/74857207#74857207). In short, don't use Cheerio with Puppeteer for exactly this reason. Puppeteer can already select elements and does it in a way that's dynamic, on the actual web page, where the elements can be interacted with, whereas Cheerio uses its own DOM tree that has no relation to what's going on in the browser and can't interact with anything. – ggorlen Feb 19 '23 at 14:39

0 Answers0