mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-21 23:59:33 -05:00
90 lines
1.9 KiB
Markdown
90 lines
1.9 KiB
Markdown
---
|
|
title: dblclick
|
|
comments: false
|
|
---
|
|
|
|
Double-click a DOM element.
|
|
|
|
# Syntax
|
|
|
|
```javascript
|
|
.dblclick()
|
|
.dblclick(options)
|
|
```
|
|
|
|
## Usage
|
|
|
|
**{% fa fa-check-circle green %} Correct Usage**
|
|
|
|
```javascript
|
|
cy.get('button').dblclick() // Double click on button
|
|
cy.focused().dblclick() // Double click on el with focus
|
|
cy.contains('Welcome').dblclick() // Double click on first el containing 'Welcome'
|
|
```
|
|
|
|
**{% fa fa-exclamation-triangle red %} Incorrect Usage**
|
|
|
|
```javascript
|
|
cy.dblclick('button') // Errors, cannot be chained off 'cy'
|
|
cy.window().dblclick() // Errors, 'window' does not yield DOM element
|
|
```
|
|
|
|
## Arguments
|
|
|
|
**{% fa fa-angle-right %} options** ***(Object)***
|
|
|
|
Pass in an options object to change the default behavior of `.dblclick()`.
|
|
|
|
Option | Default | Description
|
|
--- | --- | ---
|
|
`log` | `true` | {% usage_options log %}
|
|
`timeout` | {% url `defaultCommandTimeout` configuration#Timeouts %} | {% usage_options timeout .dblclick %}
|
|
|
|
## Yields {% helper_icon yields %}
|
|
|
|
{% yields same_subject .dblclick %}
|
|
|
|
# Examples
|
|
|
|
## Double Click
|
|
|
|
**Double click an anchor link**
|
|
|
|
```javascript
|
|
cy.get('a#nav1').dblclick() // yields the <a>
|
|
```
|
|
|
|
# Rules
|
|
|
|
## Requirements {% helper_icon requirements %}
|
|
|
|
{% requirements dom .dblclick %}
|
|
|
|
## Assertions {% helper_icon assertions %}
|
|
|
|
{% assertions actions .dblclick %}
|
|
|
|
## Timeouts {% helper_icon timeout %}
|
|
|
|
{% timeouts actions .dblclick %}
|
|
|
|
# Command Log
|
|
|
|
**Double click on a calendar schedule**
|
|
|
|
```javascript
|
|
cy.get('[data-schedule-id="4529114"]:first').dblclick()
|
|
```
|
|
|
|
The commands above will display in the command log as:
|
|
|
|

|
|
|
|
When clicking on `dblclick` within the command log, the console outputs the following:
|
|
|
|

|
|
|
|
# See also
|
|
|
|
- {% url `.click()` click %}
|