Deselect task | Zoho QEngine Help

Deselect task

In a nutshell

The Deselect task clears the selected option in a multi-select dropdown field. You can use it to remove one option from a set of selections without requiring the rest to change. It identifies which option to target by position in the list, by its visible text, or by the underlying value the page submits.

1. Overview

The Deselect task clears the selected state of an option in a multi-select dropdown field on a web page. It removes the targeted option's selection while leaving every other currently selected option untouched, since a multi-select field allows several options to stay active at once.

This task is useful whenever a workflow depends on options being added and removed independently of each other, such as a shopper narrowing down a filtered product list by removing one color or size from an active filter.

NotesNote: The Deselect and <Uncheck> tasks are two distinct actions that serve different purposes when interacting with web elements. The Deselect task clears the current selection from a dropdown, while the Uncheck task interacts with the checkbox. Learn more.

The Deselect task offers three ways to identify which option's selection gets cleared:

  1. INDEX - Targets the option by its position in the dropdown. Suited to cases when you already know the option's position in the list, with counting starting at 0 for the first entry.
  2. TEXT - Matches the option whose visible text corresponds to the specified value. Applicable when the label shown to the user is exactly what the dropdown displays.
  3. VALUE - Identifies the option using its underlying value attribute rather than the displayed value, since the page may submit something different from the visible label. This matters when the visible text alone can't identify the option, such as a size filter showing "Large" while the value actually submitted is "L".

2. Syntax

deselect(<locator>, <text>, <select_type>);

ParameterData TypeDescription
locatorSTRINGIdentifies the dropdown containing the option to remove.

Note: You can find a locator by manually inspecting the webpage for the element, or by using an element already saved through a recording session. Learn more about Elements
textSTRINGThe text or attribute value to match, according to the select type used.
select_typeSTRING

The method used to match the option inside the dropdown:

  1. select.INDEX - This targets an option by its specific index within the dropdown and deselects it. In a size selector dropdown list ordered smallest to largest, position 0 corresponds to the first entry regardless of what it displays.
  2. select.TEXT - This deselects an option from a dropdown based on its visible text content. Removing "Blue" from a color filter dropdown matches directly on that visible label.
  3. select.VALUE - This clears an option within the dropdown based on its underlying value attribute. A size filter might display "Large" while the value actually submitted underneath is "L".

3. Examples

Example 1: Deselecting a color from a multi-select color filter by position

Clears the second option in the color filter on the watch listing page by its position in the list, leaving any other selected colors in place.

// Open the watch listing page on the ZWatch Commerce website using the <Open URL> task
openURL("https://zwatch.zohocommerce.com/collections/watches", "same window");
// Deselect the second option in the color filter, using index 1 since QEngine counts positions starting from 0
deselect(ui.zwatch.color-filter-dropdown, "1", select.INDEX);

where:

"https://zwatch.zohocommerce.com/collections/watches"Watch listing page URL.
"same window"Opens the page in the window already running the test.
ui.zwatch.color-filter-dropdownStored locator for the color filter.
"1"Index of the color to clear, starting from 0.
select.INDEXClears the option by its position rather than its text or value.

Example 2: Clearing a size from a multi-select size filter by text, and confirming it

Clears "Large" from a multi-select size filter on the watch listing page, then confirms it's no longer among the selected sizes.

// Open the watch listing page on the ZWatch Commerce website using the <Open URL> task
openURL("https://zwatch.zohocommerce.com/collections/watches", "same window");
// Deselect the Large size filter using its visible text
deselect(ui.zwatch.size-filter-dropdown, "Large", select.TEXT);
// Confirm Large is no longer selected in the size filter
assertSelected(ui.zwatch.size-filter-dropdown.large, errorhandling.CONTINUE_ON_ERROR);

where:

"https://zwatch.zohocommerce.com/collections/watches"Watch listing page URL.
"same window"Opens the page in the window already running the test.
ui.zwatch.size-filter-dropdownStored locator for the size filter.
"Large"Visible text of the size to clear.
select.TEXTClears the option by matching its visible text.
ui.zwatch.size-filter-dropdown.largeStored locator for the Large option within the filter.
errorhandling.CONTINUE_ON_ERRORContinues the test and returns the result instead of stopping if Large is still selected.

Example 3: Clearing a material from a multi-select material filter by value

Clears the Titanium option from a multi-select material filter on the watch listing page, using its underlying value attribute rather than its visible label.

// Open the watch listing page on the ZWatch Commerce website using the <Open URL> task
openURL("https://zwatch.zohocommerce.com/collections/watches", "same window");
// materialValue holds the Titanium option's underlying value attribute, a short code rather than the visible text
materialValue = "TI";
// Deselect the Titanium option from the material filter by its underlying value attribute
deselect(ui.zwatch.material-filter-dropdown, materialValue, select.VALUE);

where:

"https://zwatch.zohocommerce.com/collections/watches"Watch listing page URL.
"same window"Opens the page in the window already running the test.
materialValueStores the Titanium option's underlying value attribute.
ui.zwatch.material-filter-dropdownStored locator for the material filter.
select.VALUEClears the option by its underlying value attribute instead of its visible text.

Example 4: Clearing a skill from a multi-select field in a Zoho Creator application

Clears the Python option from a multi-select skills field on a job application form, built on Zoho Creator, using the Deselect task.

// Open the job application form in the Talent application using the <Open URL> task
openURL("https://creatorapp.zoho.com/zylker/talent#Form:Job_Application", "same window");
// Deselect the Python option from the Skills field by its visible text
deselect(ui.talent.skills-field, "Python", select.TEXT);

where:

"https://creatorapp.zoho.com/zylker/talent#Form:Job_Application"Job application form URL.
"same window"Opens the form in the window already running the test.
ui.talentportal.skills-fieldStored locator for the skills field.
"Python"Visible text of the skill to clear.
select.TEXTClears the option by matching its visible text.

4. Use cases

Scenario 1: Managing notification preferences from account settings

Customers often select several notification types at once, order updates, promotions, new arrivals, then later decide to opt out of just one while keeping the rest active. If clearing one notification type also cleared the others, the customer would stop receiving updates they still wanted.

A tester uses Zoho QEngine to confirm that clearing one notification preference leaves the remaining selected preferences untouched.

Steps

  1. Open the account settings page in the same window.
  2. Select the Order Updates and Promotions notification preferences.
  3. Deselect the Promotions preference.
  4. Confirm Order Updates remains selected.

Implementation

// Step 1: Open the account settings page on the ZWatch Commerce website in the same window using the <Open URL> task
openURL("https://zwatch.zohocommerce.com/account/settings", "same window");
// Step 2: Select the Order Updates notification preference using the <Select> task
select(ui.zwatch.notification-preferences-dropdown, "Order Updates", select.TEXT);
// Step 3: Select the Promotions notification preference using the <Select> task
select(ui.zwatch.notification-preferences-dropdown, "Promotions", select.TEXT);
// Step 4: Deselect the Promotions notification preference using the Deselect task
deselect(ui.zwatch.notification-preferences-dropdown, "Promotions", select.TEXT);
// Step 5: Confirm Order Updates remains selected using the <Assert Selected> task
assertSelected(ui.zwatch.notification-preferences-dropdown.orderUpdates, errorhandling.STOP_ON_ERROR);

Scenario 2: Removing one amenity from a multi-select facility filter
Facility booking pages often let staff filter meeting rooms by several amenities at once, such as a projector and a whiteboard, then decide one amenity isn't actually needed while keeping the rest of the filter intact.

A tester uses Zoho QEngine to confirm that clearing one amenity from the filter leaves the other selected amenities in place, rather than resetting the entire filter.

Steps

  1. Open the room booking page in the same window.
  2. Select the Projector and Whiteboard amenity filters.
  3. Deselect the Projector amenity filter.
  4. Confirm Whiteboard remains selected.

Implementation

// Step 1: Open the room booking page on the ZWatch Commerce website in the same window using the <Open URL> task
openURL("https://zwatch.zohocommerce.com/facilities/rooms", "same window");
// Step 2: Select the Projector amenity filter using the <Select> task
select(ui.zwatch.amenity-filter-dropdown, "Projector", select.TEXT);
// Step 3: Select the Whiteboard amenity filter using the <Select> task
select(ui.zwatch.amenity-filter-dropdown, "Whiteboard", select.TEXT);
// Step 4: Deselect the Projector amenity filter using the <Deselect> task
deselect(ui.zwatch.amenity-filter-dropdown, "Projector", select.TEXT);
// Step 5: Confirm Whiteboard remains selected using the <Assert Selected> task
assertSelected(ui.zwatch.amenity-filter-dropdown.whiteboard, errorhandling.STOP_ON_ERROR);

Scenario 3: Removing a warehouse from a supplier's authorized delivery list

Consider a manufacturing organization that uses a Zoho Creator Supplier Management application. The Supplier Registration form includes an Applicable Warehouses multi-select field that specifies the warehouses a supplier is authorized to deliver inventory to. When a supplier stops servicing a particular warehouse, procurement staff remove that warehouse from the field while leaving the remaining warehouse assignments unchanged.

A tester uses Zoho QEngine to verify that removing one warehouse updates only the intended selection without affecting the supplier's other assigned warehouses.

Steps

  1. Open the Supplier Registration form in the Supplier Management application.
  2. Select the Chennai and Bangalore warehouses.
  3. Deselect the Chennai warehouse.
  4. Confirm Bangalore remains selected.

Implementation

// Step 1: Open the Supplier Registration form in the Supplier Management application using the <Open URL> task
openURL("https://creatorapp.zoho.com/zylker/supplier-management#Form:Supplier_Registration", "same window");
// Step 2: Select the Chennai warehouse using the <Select> task
select(ui.suppliermanagement.applicable-warehouses-field, "Chennai", select.TEXT);
// Step 3: Select the Bangalore warehouse using the <Select> task
select(ui.suppliermanagement.applicable-warehouses-field, "Bangalore", select.TEXT);
// Step 4: Deselect the Chennai warehouse using the <Deselect> task
deselect(ui.suppliermanagement.applicable-warehouses-field, "Chennai", select.TEXT);
// Step 5: Confirm Bangalore remains selected using the <Assert Selected> task
assertSelected(ui.suppliermanagement.applicable-warehouses-field.bangalore, errorhandling.STOP_ON_ERROR);

5. Points to note

  1. Deselect only clears a currently selected value from a dropdown field. For checkboxes, use the Uncheck task instead.
  2. select.INDEX uses zero-based indexing, where 0 represents the first option.
  3. select.VALUE matches the option's underlying value attribute, which can differ from the visible text. Inspect the option element in the page's DOM if the value attribute isn't already known.
  4. Prefer logical locators, such as field labels or names, over raw full XPath strings when locating the dropdown.
  1. Select
  2. Check
  3. Uncheck
  4. Clear
  5. Upload

Previous

Before using the Deselect task, it helps to know how the <Select> task works, since the two tasks operate on the same dropdown elements.

7. What's next

Now that you've used the Deselect task to remove a selected option, learn how to mark a checkbox as checked using the <Check> task.