Bird
0
0

Which Cypress assertion correctly checks that a button with id #submit is not disabled?

easy📝 Conceptual Q2 of 15
Cypress - Assertions
Which Cypress assertion correctly checks that a button with id #submit is not disabled?
Acy.get('#submit').should('be.disabled')
Bcy.get('#submit').should('not.be.disabled')
Ccy.get('#submit').should('not.exist')
Dcy.get('#submit').should('not.be.visible')
Step-by-Step Solution
Solution:
  1. Step 1: Identify the element and desired state

    The element is a button with id 'submit'. We want to check it is not disabled.
  2. Step 2: Choose the correct negative assertion

    The assertion should('not.be.disabled') verifies the button is enabled (not disabled). Other options check for disabled, existence, or visibility, which are incorrect here.
  3. Final Answer:

    cy.get('#submit').should('not.be.disabled') -> Option B
  4. Quick Check:

    Negative assertion for enabled button = B [OK]
Quick Trick: Use 'not.be.disabled' to confirm element is enabled [OK]
Common Mistakes:
  • Using 'be.disabled' instead of 'not.be.disabled'
  • Confusing 'not.exist' with enabled state
  • Checking visibility instead of disabled state

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes