Bird
0
0

Why might cy.check() fail silently when used on a disabled checkbox?

hard📝 Conceptual Q10 of 15
Cypress - Element Interactions
Why might cy.check() fail silently when used on a disabled checkbox?
ABecause Cypress requires a special flag to check disabled elements
BBecause check() only works on radio buttons
CBecause the selector is invalid for disabled elements
DBecause disabled checkboxes cannot be interacted with, so check() has no effect
Step-by-Step Solution
Solution:
  1. Step 1: Understand disabled element behavior

    Disabled checkboxes cannot be changed by user or scripts, so check() will not change their state.

  2. Step 2: Analyze other options

    Because check() only works on radio buttons is false because check() works on checkboxes and radios. Because the selector is invalid for disabled elements is false because selector works regardless of disabled. Because Cypress requires a special flag to check disabled elements is false; Cypress does not have a special flag for disabled elements.

  3. Final Answer:

    Because disabled checkboxes cannot be interacted with, so check() has no effect -> Option D
  4. Quick Check:

    Disabled elements ignore check() commands [OK]
Quick Trick: Disabled checkboxes ignore check() commands [OK]
Common Mistakes:
  • Thinking check() works on disabled
  • Confusing selector issues with disabled state
  • Believing Cypress needs flags for disabled

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes