I am trying to use puppeteer's window.find to search for some text on the webpage and in turn click on the found element. The window.find function works fine and highlights the relevant text however I am unsure how to click on the highlighted text after.
<a
class="govuk-link"
rel="nofollow"
href="/energy-certificate/4230-1322-4009-0714-2296"
>
Some Address
</a>
There is also the problem that there are multiple '''govuk-link''' on the webpage and it seems to click on the first one when referenced
if(const found = await page.evaluate(() => window.find("Some Address"))) {
await page.waitForSelector('.govuk-link');
await page.click('.govuk-link')
};
How do I click the link highlighted by window.find? I have also tried using XPath however have the same issue with multiple govuk-links