mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-18 22:28:38 -05:00
1.4 KiB
1.4 KiB
title, comments, description
| title | comments | description |
|---|---|---|
| document | true |
Get the document and work with its properties or methods.
| Returns | the window.document object |
| Timeout | cy.document will retry for the duration of the defaultCommandTimeout |
cy.document()
Get the document.
Options
Pass in an options object to change the default behavior of cy.document.
cy.document(options )
| Option | Default | Notes |
|---|---|---|
log |
true |
whether to display command in command log |
Usage
Get document and do some work
cy.document().then(function(document) {
// work with document element
});
Make an assertion about the document
cy.document().its("contentType").should("eq", "text/html")
Command Log
Get the document
cy.document()
The commands above will display in the command log as:
When clicking on document within the command log, the console outputs the following: