Testing · Junior · Question 66 of 78

How do you find an element in Cypress by a dedicated test attribute?

Explanation

Cypress recommends data-cy/data-test attributes: they don't change with styling. cy.contains("Submit") searches by text.

Further reading

Problem with a question

Testing · Junior · question 66

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz