Bird
0
0

Given this code snippet:

medium📝 Predict Output Q5 of 15
Cypress - Element Interactions
Given this code snippet:
cy.get('.hidden-radio').check({ force: true }).should('be.checked');

What will the assertion check?
AThat the radio button is not checked
BThat the radio button is visible and checked
CThat the radio button is disabled
DThat the hidden radio button is checked successfully
Step-by-Step Solution
Solution:
  1. Step 1: Understand check with force:true

    The { force: true } option allows checking a hidden radio button.
  2. Step 2: Understand assertion meaning

    The should('be.checked') asserts the radio button is checked regardless of visibility.
  3. Final Answer:

    That the hidden radio button is checked successfully -> Option D
  4. Quick Check:

    force:true check + should('be.checked') = checked hidden element [OK]
Quick Trick: Use force:true to check hidden radios and assert checked [OK]
Common Mistakes:
  • Assuming visibility is required for assertion
  • Confusing disabled state with checked
  • Thinking assertion checks visibility

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes