Skip to content

I.deselected() ​

Asserts that a checkbox, radio button, or select dropdown option is currently NOT selected (unchecked).

If the element is unchecked or not selected, the assertion passes and the test script continues. If the element is selected, the test automatically retries until the command timeout is reached, then fails.

Usage ​

javascript
// assert that a uniquely identifiable option is NOT selected
I.deselected(option: string)

// assert that an option within a specific group or dropdown is NOT selected
I.deselected(list: string, option: string)

Parameters ​

ParameterTypeDescription
liststring(optional) The group or dropdown containing the option — by visible text, name attribute, CSS or XPath selector
optionstringThe option element to assert — by visible text, value, CSS or XPath selector

Examples ​

Checkbox ​

Here's a simple checkbox for illustration:


Demo: Simple Checkbox
UI
HTML

Assert that the checkbox is currently unchecked:

js
// using visible label (recommended)
I.deselected("I agree")

// using option value
I.deselected("agree")

// using CSS selector (visible inputs only)
I.deselected("#agree-checkbox")

Hidden or Custom-Styled Checkboxes

When asserting state on custom-styled or hidden checkboxes, use the visible label text (e.g. I.deselected("I agree")) to allow UI-licious to resolve the associated input element.

Radio button group ​

Here's a group of radio buttons for illustration:

Door color

Frame color
Demo: Radio Button Group
UI
HTML

When multiple groups share the same option labels, specify both the group and option:

js
// using group label and option label
I.deselected("Door color", "Blue")

// using group name attribute and option label
I.deselected("door-color", "Blue")

If the option label is unique across the page, you can assert it directly:

js
I.deselected("Blue")

Select dropdown ​

Here's a <select> dropdown for illustration:


Demo: Select Dropdown
UI
HTML

Assert that an option within a <select> dropdown is NOT selected:

js
// using dropdown label and option text
I.deselected("Country", "United States")

// using dropdown label and option value attribute
I.deselected("Country", "US")

// using dropdown name attribute and option text
I.deselected("country", "United States")

// using dropdown CSS selector and option text
I.deselected("#country-field", "United States")
CommandDescription
I.deselect()Uncheck an already checked checkbox
I.selected()Assert that an option, checkbox, or radio button is selected
I.select()Check a checkbox or radio button, or select a dropdown option

See Also ​