mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-19 22:59:16 -05:00
72 lines
1.7 KiB
Markdown
72 lines
1.7 KiB
Markdown
---
|
|
title: reload
|
|
comments: true
|
|
description: ''
|
|
---
|
|
|
|
Reload the page.
|
|
|
|
| | |
|
|
|--- | --- |
|
|
| **Returns** | the `window` object of the newly reloaded page |
|
|
| **Timeout** | `cy.reload` will retry for the duration of the [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) or the duration of the `timeout` specified in the command's [options](#options). |
|
|
|
|
# [cy.reload()](#usage)
|
|
|
|
Reload the page from the current URL.
|
|
|
|
# [cy.reload( *forceReload* )](#force-reload-usage)
|
|
|
|
Reload the current page, without using the cache if `forceReload` is true
|
|
|
|
# Options
|
|
|
|
Pass in an options object to change the default behavior of `cy.reload`.
|
|
|
|
**cy.reload( *options* )**
|
|
|
|
Option | Default | Notes
|
|
--- | --- | ---
|
|
`timeout` | [pageLoadTimeout](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry the visit
|
|
`log` | `true` | whether to display command in command log
|
|
|
|
# Usage
|
|
|
|
## Reload the page as if the user clicked the Refresh button
|
|
|
|
```javascript
|
|
cy
|
|
.visit("http://localhost:3000/admin")
|
|
.reload()
|
|
```
|
|
|
|
# Force Reload Usage
|
|
|
|
## Reload the page without using the cache
|
|
|
|
```javascript
|
|
cy
|
|
.visit("http://localhost:3000/admin")
|
|
.reload(true)
|
|
```
|
|
|
|
# Command Log
|
|
|
|
## Reload the page
|
|
|
|
```javascript
|
|
cy.reload()
|
|
```
|
|
|
|
The commands above will display in the command log as:
|
|
|
|

|
|
|
|
When clicking on `cy.reload` within the command log, the console outputs the following:
|
|
|
|

|
|
|
|
# Related
|
|
|
|
- [location](https://on.cypress.io/api/location)
|