Bird
0
0

How do you correctly perform an accessibility check on the element with selector #main-content using cypress-axe?

easy📝 Syntax Q3 of 15
Cypress - Plugins and Ecosystem
How do you correctly perform an accessibility check on the element with selector #main-content using cypress-axe?
Acy.checkA11y('#main-content')
Bcy.injectAxe('#main-content')
Ccy.checkA11y({ selector: '#main-content' })
Dcy.visit('#main-content').checkA11y()
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct command

    The cy.checkA11y() command accepts a selector string to limit the scope of the accessibility check.
  2. Step 2: Syntax

    Passing the selector as a string argument is the correct syntax: cy.checkA11y('#main-content').
  3. Final Answer:

    cy.checkA11y('#main-content') -> Option A
  4. Quick Check:

    checkA11y accepts selector string [OK]
Quick Trick: Use cy.checkA11y with selector string to target elements [OK]
Common Mistakes:
  • Using cy.injectAxe with a selector
  • Passing selector inside an object incorrectly
  • Trying to chain checkA11y after cy.visit with selector

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes