Skip to content
masterclass Buddy

Cypress · Function

cy.location

cy.location() reads the active page URL. It returns the whole location object or one URL property, such as pathname, host, or searchParams.

Last updated

Since
15.0.0

Syntax

cy.location()
cy.location(key)
cy.location(options)
cy.location(key, options)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cy.url()
  • cy.hash()
  • cy.origin()

Source: cy.location() | Cypress API Documentation. Checked 2026-11-03.