Bird
0
0

Why might cy.go(-1) not change the page during a test even though it is called?

hard📝 Conceptual Q10 of 15
Cypress - Navigation and URL
Why might cy.go(-1) not change the page during a test even though it is called?
AThe test must call cy.reload() before cy.go()
Bcy.go() only works with positive numbers
Ccy.go() requires a callback to execute
DThere is no previous page in the browser history to go back to
Step-by-Step Solution
Solution:
  1. Step 1: Understand browser history behavior

    If the browser has no previous page in history, cy.go(-1) cannot move back.
  2. Step 2: Evaluate other options

    cy.go() works with negative numbers, does not require callbacks, and does not need reload before use.
  3. Final Answer:

    No previous page in history to go back to -> Option D
  4. Quick Check:

    cy.go(-1) needs previous page in history [OK]
Quick Trick: cy.go(-1) does nothing if no back history exists [OK]
Common Mistakes:
  • Thinking cy.go() needs callbacks
  • Believing cy.go() only accepts positive numbers
  • Assuming reload is required before cy.go()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes