0
0
Cypresstesting~20 mins

Chaining selectors in Cypress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Chaining Selectors Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this chained selector test?
Consider the following Cypress test code snippet. What will be the result of the assertion?
Cypress
cy.get('form#login').find('input[type="text"]').should('have.length', 2)
ATest fails because 'find' cannot be chained after 'get'
BTest passes if the page contains any 2 text input fields anywhere
CTest passes if the form with id 'login' contains exactly 2 text input fields
DTest fails because 'should' cannot be used with 'have.length'
Attempts:
2 left
💡 Hint
Remember that chaining selectors narrows down the search within the previous element.
assertion
intermediate
1:30remaining
Which assertion correctly verifies the chained selector result?
You have chained selectors to get all buttons inside a div with class 'container'. Which assertion correctly checks that there are 3 buttons?
Cypress
cy.get('div.container').find('button')
A.should('contain.text', '3')
B.should('have.length', 3)
C.should('have.text', '3')
D.should('exist', 3)
Attempts:
2 left
💡 Hint
Check the assertion that verifies the number of elements found.