Files
cypress/docs/source/api/commands/dblclick.md
T
2017-05-24 16:56:23 -04:00

2.0 KiB

title, comments, description
title comments description
dblclick true

Double-click a DOM element.

Syntax

.dblclick()
.dblclick(options)

Usage

.dblclick() requires being chained off another cy command that yields a DOM element.

{% fa fa-check-circle green %} Valid Usage

cy.get('button').dblclick()          // Double clicks on button
cy.focused().dblclick()              // Double clicks on el with focus
cy.contains('Welcome').dblclick()    // Double clicks on first el containing 'Welcome'

{% fa fa-exclamation-triangle red %} Invalid Usage

cy.click('button')          // Errors, cannot be chained off 'cy'
cy.window().click()         // 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 Notes
log true whether to display command in command log

Yields

.dblclick() yields the DOM subject chained from the previous command.

Timeout

.dblclick() will wait for the duration of the defaultCommandTimeout

Examples

Double Click

Double click an anchor link

<a href="#nav1">Menu</a>
cy.get('#nav1').dblclick() // yields the <a>

Command Log

Double click on a calendar schedule

cy.get('[data-schedule-id="4529114"]:first').dblclick()

The commands above will display in the command log as:

screen shot 2015-11-29 at 1 12 02 pm

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

screen shot 2015-11-29 at 1 12 26 pm

See also