0
0
Cypresstesting~10 mins

cy.prev() and cy.next() in Cypress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the previous sibling element using Cypress.

Cypress
cy.get('.item').[1]()
Drag options to blanks, or click blank then click option'
Achildren
Bnext
Cparent
Dprev
Attempts:
3 left
💡 Hint
Common Mistakes
Using cy.next() instead of cy.prev() to get the previous sibling.
Using cy.parent() which gets the parent element, not the sibling.
2fill in blank
medium

Complete the code to get the next sibling element using Cypress.

Cypress
cy.get('.button').[1]()
Drag options to blanks, or click blank then click option'
Aprev
Bsiblings
Cnext
Dchildren
Attempts:
3 left
💡 Hint
Common Mistakes
Using cy.prev() instead of cy.next() to get the next sibling.
Using cy.children() which gets child elements, not siblings.
3fill in blank
hard

Fix the error in the code to correctly get the previous sibling element.

Cypress
cy.get('.active').[1]
Drag options to blanks, or click blank then click option'
Aprev
Bprev()
Cnext()
Dsiblings()
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to add parentheses after the command name.
Using cy.next() instead of cy.prev() when wanting the previous sibling.
4fill in blank
hard

Fill both blanks to get the next sibling and then its previous sibling.

Cypress
cy.get('.start').[1]().[2]()
Drag options to blanks, or click blank then click option'
Anext
Bprev
Csiblings
Dparent
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of commands.
Using cy.siblings() which gets all siblings, not just next or previous.
5fill in blank
hard

Fill all three blanks to get the previous sibling, then its next sibling, and finally its parent element.

Cypress
cy.get('.item').[1]().[2]().[3]()
Drag options to blanks, or click blank then click option'
Aprev
Bnext
Cparent
Dchildren
Attempts:
3 left
💡 Hint
Common Mistakes
Using cy.children() instead of cy.parent() at the end.
Mixing up the order of prev and next commands.