How to trigger a click wherever an HTML element appears with Puppeteer?

I tried

await page.click("div:contains('text')")

but it doesn’t work.

Is it not possible to do so? Would I somehow have to grab the wrapper/”parent” of the HTML first, then call a click on it?