Bird
0
0

What does the Cypress assertion should('exist') check for?

easy📝 Conceptual Q2 of 15
Cypress - Assertions
What does the Cypress assertion should('exist') check for?
AElement is visible on the page
BElement contains specific text
CElement is present in the DOM
DElement is enabled for interaction
Step-by-Step Solution
Solution:
  1. Step 1: Understand 'exist' assertion

    should('exist') verifies that the element is present in the DOM tree, regardless of whether it is visible or hidden.
  2. Step 2: Differentiate from other assertions

    should('be.visible') checks visibility; should('have.text') checks text content; should('be.enabled') checks if element can be interacted with.
  3. Final Answer:

    Element is present in the DOM -> Option C
  4. Quick Check:

    Existence assertion = should('exist') [OK]
Quick Trick: Use should('exist') to check DOM presence only [OK]
Common Mistakes:
  • Thinking 'exist' means visible
  • Confusing 'exist' with 'have.text'
  • Assuming 'exist' means enabled

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes