Bird
0
0

You need to visit 'https://example.com' and allow up to 15 seconds for the page to load before the test fails. Which of the following cy.visit() usages correctly implements this?

hard📝 Application Q8 of 15
Cypress - Navigation and URL
You need to visit 'https://example.com' and allow up to 15 seconds for the page to load before the test fails. Which of the following cy.visit() usages correctly implements this?
Acy.visit('https://example.com', { timeout: 15000 })
Bcy.visit('https://example.com', { waitForLoad: 15000 })
Ccy.visit('https://example.com', 15000)
Dcy.visit('https://example.com').timeout(15000)
Step-by-Step Solution
Solution:
  1. Step 1: Understand timeout option

    The timeout option in cy.visit() sets the maximum wait time for the page load.
  2. Step 2: Evaluate options

    cy.visit('https://example.com', { timeout: 15000 }) correctly passes { timeout: 15000 } as the second argument. Options B, C, and D use invalid syntax or unsupported options.
  3. Final Answer:

    cy.visit('https://example.com', { timeout: 15000 }) -> Option A
  4. Quick Check:

    Use { timeout: ms } option for wait time [OK]
Quick Trick: Use { timeout: 15000 } option in cy.visit() [OK]
Common Mistakes:
  • Passing timeout as a positional argument
  • Using unsupported option names like waitForLoad
  • Trying to chain timeout() after cy.visit()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes