Bird
0
0

How can you scroll the page smoothly to coordinates (0, 500) using cy.scrollTo()?

hard📝 Application Q9 of 15
Cypress - Element Interactions
How can you scroll the page smoothly to coordinates (0, 500) using cy.scrollTo()?
Acy.scrollTo(0, 500, { easing: 'smooth', duration: 1000 });
Bcy.scrollTo(0, 500, { easing: 'linear', duration: 1000 });
Ccy.scrollTo(0, 500, { smooth: true });
Dcy.scrollTo(0, 500, { animation: 'smooth' });
Step-by-Step Solution
Solution:
  1. Step 1: Recall options for smooth scrolling

    scrollTo accepts options with easing and duration to control animation.
  2. Step 2: Identify correct easing value

    'linear' and 'swing' are valid easing values; 'smooth' is not a valid easing value.
  3. Final Answer:

    cy.scrollTo(0, 500, { easing: 'linear', duration: 1000 }); -> Option B
  4. Quick Check:

    Use easing and duration options for smooth scroll [OK]
Quick Trick: Use easing and duration options for smooth scroll [OK]
Common Mistakes:
  • Using invalid easing values
  • Using unsupported options like smooth or animation
  • Omitting duration for animation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes