Bird
0
0

What does cy.location() return by default when called without arguments?

easy📝 Conceptual Q1 of 15
Cypress - Navigation and URL
What does cy.location() return by default when called without arguments?
AAn object representing the current URL parts
BA string of the full URL
CThe page title
DThe HTTP status code
Step-by-Step Solution
Solution:
  1. Step 1: Understand the default behavior of cy.location()

    When called without arguments, cy.location() yields an object with URL parts like pathname, hostname, protocol, etc.
  2. Step 2: Compare with other options

    It does not return a string, page title, or status code by default.
  3. Final Answer:

    An object representing the current URL parts -> Option A
  4. Quick Check:

    cy.location() = object [OK]
Quick Trick: cy.location() returns URL parts object by default [OK]
Common Mistakes:
  • Thinking it returns a string URL
  • Confusing with cy.title()
  • Expecting HTTP status code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes