Bird
0
0

Which of the following is the correct syntax to scroll an element with id content to coordinates (100, 200)?

easy📝 Syntax Q3 of 15
Cypress - Element Interactions
Which of the following is the correct syntax to scroll an element with id content to coordinates (100, 200)?
Acy.get('#content').scrollTo({x: 100, y: 200});
Bcy.scrollTo('#content', 100, 200);
Ccy.get('#content').scrollTo(100, 200);
Dcy.scrollTo(100, 200).get('#content');
Step-by-Step Solution
Solution:
  1. Step 1: Understand chaining with cy.get()

    To scroll an element, first select it with cy.get(), then call scrollTo() on it.
  2. Step 2: Check correct syntax for coordinates

    Coordinates are passed as two numbers: scrollTo(100, 200).
  3. Final Answer:

    cy.get('#content').scrollTo(100, 200); -> Option C
  4. Quick Check:

    Element scrollTo syntax = cy.get().scrollTo(x, y) [OK]
Quick Trick: Use cy.get(selector).scrollTo(x, y) to scroll element [OK]
Common Mistakes:
  • Passing selector inside scrollTo
  • Calling scrollTo before get
  • Using object instead of coordinates incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes