Files
cypress/docs/source/api/commands/uncheck.md
T
2017-05-19 11:51:03 -04:00

2.4 KiB

title: uncheck comments: true

Unchecks the checkboxes within the current subject.

The following events are fired during uncheck: mousedown, focus, mouseup, click

Returns the new DOM element(s) found by the command.
Timeout cy.uncheck will retry for the duration of the defaultCommandTimeout or the duration of the timeout specified in the commands options.

cy.uncheck()

Unchecks checkboxes. Triggers events associated with check.

cy.uncheck( values )

Unchecks the checkboxes matching the values. Triggers events associated with uncheck.

Options

Pass in an options object to change the default behavior of cy.uncheck.

cy.uncheck( options )

Option Default Notes
interval 16 Interval which to retry a uncheck
timeout defaultCommandTimeout Total time to retry the uncheck
force false Forces uncheck, disables error checking prior to uncheck
log true whether to display command in command log
multiple false Enables serially unchecking multiple elements

Usage

Uncheck all checkboxes

cy.get(":checkbox").uncheck()

Uncheck all radios

cy.get("[type='checkbox']").uncheck()

Uncheck element with the id saveUserName

cy.get("#saveUserName").uncheck()

Values Usage

Uncheck the checkbox with the value of "ga"

cy.get("input[type='checkbox']").uncheck(["ga"])

Command Log

Uncheck the first checkbox

cy
  .get("[data-js='choose-all']").click()
  .find("input[type='checkbox']").first().uncheck()

The commands above will display in the command log as:

screen shot 2015-11-29 at 1 30 49 pm

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

screen shot 2015-11-29 at 1 31 04 pm

Related