Puppeteer – Iterate over span and click on text when it matches

I want to iterate over the span elements and when I find the matching text, I would like to click on it

The HTML looks like this, please click on the image

HTML Image

What I am trying to do is select the option in span using its “text”. I cannot use class since the class name is similar everywhere

Currently what I am doing is

await page.evaluate(() => {
  const elements = [...document.querySelectorAll('label > span.slds-form-element__label')];
  const targetElement = elements.find(e => e.innerText == 'Event Badge Scans');
  if (targetElement) targetElement.click();
});
})