Bird
0
0

You want to scroll an element with class menu to the center horizontally and bottom vertically. Which command is correct?

hard📝 Application Q8 of 15
Cypress - Element Interactions
You want to scroll an element with class menu to the center horizontally and bottom vertically. Which command is correct?
Acy.get('.menu').scrollTo('center bottom');
Bcy.get('.menu').scrollTo({left: 'center', top: 'bottom'});
Ccy.get('.menu').scrollTo('center', 'bottom');
Dcy.get('.menu').scrollTo('bottom center');
Step-by-Step Solution
Solution:
  1. Step 1: Understand combined position syntax

    scrollTo accepts a single string with vertical and horizontal positions separated by space, e.g., 'bottom center'.
  2. Step 2: Evaluate options

    cy.get('.menu').scrollTo('bottom center'); uses correct syntax 'bottom center'. cy.get('.menu').scrollTo('center bottom'); reverses order, cy.get('.menu').scrollTo('center', 'bottom'); passes two strings incorrectly, D uses invalid object keys.
  3. Final Answer:

    cy.get('.menu').scrollTo('bottom center'); -> Option D
  4. Quick Check:

    Use single string with vertical and horizontal positions [OK]
Quick Trick: Use one string with vertical and horizontal positions separated by space [OK]
Common Mistakes:
  • Passing two separate strings
  • Reversing vertical and horizontal order
  • Using invalid object syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes