Bird
0
0

Which of the following is the correct syntax to assert that a button with id submit is visible in Cypress?

easy📝 assertion Q12 of 15
Cypress - Assertions
Which of the following is the correct syntax to assert that a button with id submit is visible in Cypress?
Acy.get('submit').should('visible')
Bcy.find('#submit').assert('visible')
Ccy.get('#submit').should('be.visible')
Dcy.get('#submit').check('visible')
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct Cypress assertion syntax

    In Cypress, cy.get(selector).should('be.visible') checks visibility.
  2. Step 2: Compare options with correct syntax

    cy.get('#submit').should('be.visible') matches the correct syntax exactly; others have wrong methods or missing quotes.
  3. Final Answer:

    cy.get('#submit').should('be.visible') -> Option C
  4. Quick Check:

    Correct assertion syntax = B [OK]
Quick Trick: Use cy.get() with .should('be.visible') for visibility checks [OK]
Common Mistakes:
  • Missing '#' for id selector
  • Using wrong assertion method like check or assert
  • Omitting quotes around assertion string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes