Bird
0
0

Which of the following is the correct syntax to click a hidden button with id submitBtn using Cypress?

easy📝 Syntax Q12 of 15
Cypress - Element Interactions
Which of the following is the correct syntax to click a hidden button with id submitBtn using Cypress?
Acy.get('#submitBtn').click(force=true);
Bcy.get('#submitBtn').click(force:true);
Ccy.get('#submitBtn').click({ force = true });
Dcy.get('#submitBtn').click({ force: true });
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct object syntax for options

    Cypress expects options as an object inside curly braces with key-value pairs, e.g., { force: true }.
  2. Step 2: Identify correct syntax among options

    cy.get('#submitBtn').click({ force: true }); uses the correct object syntax with curly braces and colon separator.
  3. Final Answer:

    cy.get('#submitBtn').click({ force: true }); -> Option D
  4. Quick Check:

    Options object uses curly braces and colon [OK]
Quick Trick: Use curly braces and colon for options: { force: true } [OK]
Common Mistakes:
  • Using parentheses instead of braces for options
  • Using equal sign instead of colon
  • Missing braces around options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes