mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-01 12:30:01 -05:00
2.4 KiB
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:
When clicking on uncheck within the command log, the console outputs the following: