mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-22 06:59:30 -06:00
1.6 KiB
1.6 KiB
title, comments
| title | comments |
|---|---|
| title | true |
Get the title of the document.
Syntax
cy.title()
cy.title(options)
Usage
cy.title() cannot be chained off any other cy commands, so should be chained off of cy for clarity.
{% fa fa-check-circle green %} Valid Usage
cy.title()
Arguments
{% fa fa-angle-right %} options (Object)
Pass in an options object to change the default behavior of cy.title().
| Option | Default | Notes |
|---|---|---|
log |
true |
Whether to display command in Command Log |
Yields
cy.title() yields the document title as a string.
Timeout
cy.title() will continue to retry for the duration of the defaultCommandTimeout
Examples
Title
Assert that the document's title is "My Awesome Application"
cy.title().should('eq', 'My Awesome Application')
Command Log
Assert that the document's title includes 'New User'
cy.title().should('include', 'New User')
The commands above will display in the command log as:
When clicking on title within the command log, the console outputs the following:
See also
- {% url
cy.document()document %}