Bird
0
0

Identify the error in this Cypress command:

medium📝 Debug Q6 of 15
Cypress - Element Interactions
Identify the error in this Cypress command:
cy.get('.hidden-btn').click(force: true);
Aforce:true should be a string
BOptions must be inside curly braces: { force: true }
Cclick() does not accept any options
DThe selector '.hidden-btn' is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax for options

    Options must be passed as an object inside curly braces, e.g., { force: true }.
  2. Step 2: Verify other options

    The selector is valid, click accepts options, and force:true is a boolean, not a string.
  3. Final Answer:

    Options must be inside curly braces: { force: true } -> Option B
  4. Quick Check:

    Options syntax requires braces { } [OK]
Quick Trick: Always wrap options in { } when passing to commands [OK]
Common Mistakes:
  • Passing options without braces
  • Misunderstanding click command options
  • Using string instead of boolean for force

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes