Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to scroll the page to the bottom using Cypress.
Cypress
cy.scrollTo([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
"top" scrolls to the top, not bottom.Using directions like
"left" or "right" scroll horizontally.✗ Incorrect
Using "bottom" scrolls the page to the bottom.
2fill in blank
mediumComplete the code to scroll the element with id 'content' to the top.
Cypress
cy.get('#content').scrollTo([1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
"bottom" scrolls to the bottom instead.Using
"center" scrolls to the middle, not top.✗ Incorrect
The "top" option scrolls the element to its top.
3fill in blank
hardFix the error in the code to scroll to the right side of the page.
Cypress
cy.scrollTo([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
"left" scrolls to the left side.Using
"bottom" scrolls vertically down.✗ Incorrect
The correct direction to scroll horizontally to the right is "right".
4fill in blank
hardFill both blanks to scroll the element with class 'box' to the center horizontally and vertically.
Cypress
cy.get('.box').scrollTo([1], [2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing
"top" or "bottom" with horizontal scroll.Using different values for horizontal and vertical when centering.
✗ Incorrect
Using "center" for both horizontal and vertical scroll positions centers the element.
5fill in blank
hardFill all three blanks to scroll the element with id 'panel' to the bottom right corner smoothly.
Cypress
cy.get('#panel').scrollTo([1], [2], { easing: [3] })
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping vertical and horizontal directions.
Using
"top" instead of "bottom" for vertical scroll.Using invalid easing values.
✗ Incorrect
Scroll horizontally to "right", vertically to "bottom", and use "linear" easing for smooth scrolling.