Cypress - Selecting Elements
You want to click a link that contains the text 'Learn More' but only if it is inside a div with class 'info'. Which is the correct Cypress command?
cy.get('div.info').contains('Learn More'). cy.contains('div.info', 'Learn More').click() tries to use selector in contains incorrectly. cy.contains('Learn More').get('div.info').click() reverses order. cy.get('div.info').click().contains('Learn More') clicks div before contains, which is wrong.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions