I cannot click on LinkedIn buttons using puppeteer

Viewed 145

I have been trying to click on the connect buttons of the LinkedIn search using puppeteer but it's not possible.

This is the URL I have been trying to work with: https://www.linkedin.com/search/results/people/?keywords=actor&origin=GLOBAL_SEARCH_HEADER

const connectButtons = await page.$$('button.search-result__action-button')
connectButtons.forEach(async link => {
  await page.evaluate(() => link.click())
})

When I check the generated HTML, I get a different content. Have LinkedIn changed how the way content is rendered that's why it's not possible to perform actions?

1 Answers

Try:

const buttons = await page.$$('button.search-result__action-button')

for (const button of buttons)
    await button.click();
Related