Cypress · Middle · Question 50 of 77
What does cy.contains('button', /^Save$/) add with a regex?
- 1Case-insensitive search in every element
- 2Exact matching of the text, not a substring
- 3Searching only the first button on the page
Show the answer
Correct answer: Exact matching of the text, not a substring
Explanation
A plain string matches substrings, so "Save draft" would also match "Save". A regex makes the match precise.