Click an exact match text in Cypress
Regular Expressions will work nicely here. .contains() allows for regex So you can do a regex that matches the whole string only (use ^ and $). That way anything with extra characters won’t match (like New Navigation Label). So for example, you could do: cy.get(`[data-test=”dropdown”]`) .find(‘.item’) .contains(/^Navigation Label$/) .click(); Regex is a little tricky when … Read more