Skip to content

how to select span with specific email attribute value with Puppeteer

using Puppeteer trying to search in my email page for recent emails that contain specific (“email” in my case) attribute or by the text value at least

<span  email="[email protected]" name="Moon">Moon</span>

Answer

Using $:

const ele = await page.$('span[email="[email protected]"]');