Bird
0
0

Given the code snippet:

medium📝 Predict Output Q13 of 15
Cypress - Element Interactions
Given the code snippet:
cy.scrollTo(0, 500);
cy.get('#footer').should('be.visible');

What does cy.scrollTo(0, 500) do before checking the footer visibility?
AScrolls to the top-left corner
BScrolls horizontally 500px and vertically 0px down
CScrolls horizontally 0px and vertically 500px down
DScrolls to the bottom of the page
Step-by-Step Solution
Solution:
  1. Step 1: Understand scrollTo(x, y) parameters

    The first number is horizontal (x), second is vertical (y) scroll in pixels.
  2. Step 2: Apply values from code

    Here, x=0 means no horizontal scroll, y=500 means scroll down 500 pixels vertically.
  3. Final Answer:

    Scrolls horizontally 0px and vertically 500px down -> Option C
  4. Quick Check:

    scrollTo(x=0, y=500) = vertical 500px down [OK]
Quick Trick: First number is horizontal, second is vertical pixels [OK]
Common Mistakes:
  • Mixing up x and y values
  • Assuming scrollTo scrolls to bottom automatically
  • Thinking scrollTo(0, 500) scrolls horizontally

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes