In a nutshell
The Assert Value task retrieves the current underlying value held by a form element and compares it with the expected value defined in your test. The comparison is case-sensitive, so differences in capitalization will cause the assertion to fail. This confirms that a value set earlier in the test, such as text typed into a quantity, username, or password field, still holds as expected when a later step checks it.
This task evaluates the data inside form components such as text boxes, password fields, or dropdown menus. When dealing with dropdowns, the system specifically checks the selected option's underlying value attribute rather than the visible text label shown on the screen.
The task functions as a checkpoint that reacts differently depending on the output. When a mismatch occurs, it can either stop the test immediately or log the failure while execution continues. The output can also be saved to a variable, allowing subsequent steps to make decisions based on the result.
Note: Assert Value checks the value held by a form element and not visible text on the page. Use Assert Text for content displayed outside a form element.assertValue(<locator>, <value>, <errorHandling>);
(or)
<variable> = assertValue(<locator>, <value>, <errorHandling>);
| Parameter | Data Type | Description |
| locator | STRING | Identifies the element that should hold the expected value. 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. |
| value | STRING | Value expected to be held in the element. |
| errorHandling | STRING | Determines how the test behaves if the value doesn't match:
|
After entering a search term, the value in the search box gets checked to confirm if it is registered correctly.
// Open the ZWatch Commerce home page using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Click the search icon to reveal the search input using the Click task
click(".theme-search");
// Enter a search term using the Set Value task
setValue("[data-search-input]", "Chrono 44");
// Confirm the search box holds the entered term
assertValue("[data-search-input]", "Chrono 44", errorhandling.STOP_ON_ERROR);where:
| "https://zwatch.zohocommerce.com/" | ZWatch Commerce home page URL. |
| "same window" | Opens the page in the window already running the test. |
| .theme-search | Locator for the search icon. |
| [data-search-input] | Locator for the search box. |
| "Chrono 44" | Expected value held in the search box. |
| errorhandling.STOP_ON_ERROR | Stops the test if the search box doesn't hold the entered term. |
// Open the login page using the Open URL task
openURL("https://www.<website_name>.com/<login_page>", "same window");
// Enter the username using the Set Value task
setValue(ui.<login_page>.<username_field>, "chris.morgan");
// Confirm the username field holds the entered value
assertValue(ui.<login_page>.<username_field>, "chris.morgan", errorhandling.STOP_ON_ERROR);where:
| "https://www.<website_name>.com/<login_page>" | Login page URL. |
| "same window" | Opens the page in the window already running the test. |
| ui.<login_page>.<username_field> | Locator for the username field. |
| "chris.morgan" | Expected value held in the username field. |
| errorhandling.STOP_ON_ERROR | Stops the test if the field doesn't hold the entered value. |
A quantity field on a checkout page gets checked to confirm it holds the intended amount before the order proceeds.
// Open the checkout page using the Open URL task
openURL("https://www.<website_name>.com/<checkout_page>", "same window");
// Enter a quantity using the Set Value task
setValue(ui.<checkout_page>.<quantity_field>, "3");
// Confirm the quantity field holds the entered amount
assertValue(ui.<checkout_page>.<quantity_field>, "3", errorhandling.CONTINUE_ON_ERROR);where:
| "https://www.<website_name>.com/<page_name>" | Checkout page URL. |
| "same window" | Opens the page in the window already running the test. |
| ui.<page_name>.<element_name> | Locator for the quantity field. |
| "3" | Expected value held in the quantity field. |
| errorhandling.CONTINUE_ON_ERROR | Continues the test and returns the result instead of stopping if the value doesn't match. |
A lease form's tenant name field, on Zoho Creator, gets checked after the field is filled.
// Open the lease form in the Lease Tracker application using the Open URL task
openURL("https://creatorapp.zoho.com/orgname/lease-tracker#Form:New_Lease", "same window");
// Enter the tenant name using the Set Value task
setValue(ui.leasetracker.tenant-name-field, "Morgan Blake");
// Confirm the tenant name field holds the entered value
assertValue(ui.leasetracker.tenant-name-field, "Morgan Blake", errorhandling.STOP_ON_ERROR);where:
| "https://creatorapp.zoho.com/orgname/lease-tracker#Form:New_Lease" | Lease form URL. |
| "same window" | Opens the form in the window already running the test. |
| ui.leasetracker.tenant-name-field | Locator for the tenant name field. |
| "Morgan Blake" | Expected value held in the tenant name field. |
| errorhandling.STOP_ON_ERROR | Stops the test if the field doesn't hold the entered value. |
After selecting a strap material from a dropdown, its underlying value gets checked to confirm the correct option was selected, not just its visible label.
// Open the Diver Chronomat product page on the ZWatch Commerce website using the Open URL task
openURL("https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722", "same window");
// Step 2: Select the Leather option in the Strap Material dropdown by its position
select("select[data-zs-attribute-name='Strap Material']", "1", select.INDEX);
// Step 3: Confirm the dropdown's underlying value matches the Leather option's value attribute
assertValue("select[data-zs-attribute-name='Strap Material']", "3531661000000075706", errorhandling.STOP_ON_ERROR);where:
| "https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722" | Diver Chronomat product page URL. |
| "same window" | Opens the page in the window already running the test. |
| select[data-zs-attribute-name='Strap Material'] | Locator for the Strap Material dropdown. |
| "1" | Index of the Leather option, starting from 0. |
| select.INDEX | Selects the option by its position rather than its text or value. |
| "3531661000000075706" | The Leather option's actual underlying value attribute, not its index or visible label. |
| errorhandling.STOP_ON_ERROR | Stops the test if the dropdown's value doesn't match. |
Shoppers sometimes refresh a page mid-search. Depending on how the search field is configured, it may retain the previous search term instead of clearing it, which could confuse results on the next attempt.
A tester uses Zoho QEngine to check whether the search field clears after a reload rather than retaining the earlier term. If the field doesn't clear, an old search term could linger and interfere with a shopper's next search.
Steps
Implementation
// Step 1: Open the ZWatch Commerce home page in the same window using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Step 2: Click the search icon to reveal the search input using the Click task
click(".theme-search");
// Step 3: Enter a search term using the Set Value task
setValue("[data-search-input]", "Chrono 44");
// Step 4: Reload the home page using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Step 5: Confirm the search box no longer holds the entered term
assertValue("[data-search-input]", "", errorhandling.STOP_ON_ERROR);Registration forms that support saving a draft need to restore the entered details when the customer returns.
A tester uses Zoho QEngine to confirm that reloading a saved registration draft restores the entered email address rather than losing it. If the draft doesn't restore correctly, customers returning to continue a registration could find their progress lost.
Steps
Implementation
// Step 1: Open the registration form in the same window using the Open URL task
openURL("https://www.<website_name>.com/<registration_page>", "same window");
// Step 2: Enter an email address using the Set Value task
setValue(ui.<registration_page>.<email_field>, "jamie.rivera@example.com");
// Step 3: Save the draft using the Click task
click(ui.<registration_page>.<save_draft_button>);
// Step 4: Reload the registration form using the Open URL task
openURL("https://www.<website_name>.com/<registration_page>", "same window");
// Step 5: Confirm the email field still holds the entered value
assertValue(ui.<registration_page>.<email_field>, "jamie.rivera@example.com", errorhandling.STOP_ON_ERROR);A tester uses Zoho QEngine to confirm that clicking Renew Lease on a tenant's record carries their details over to the Lease Renewal form correctly. If the validation failed, a property manager could send a renewal form with missing or incorrect tenant details.
Steps
Implementation
// Step 1: Open the Leases report in the Lease Tracker application using the Open URL task
openURL("https://creatorapp.zoho.com/orgname/lease-tracker#Report:Leases", "same window");
// Step 2: Click the tenant's lease record to open it in Detail View using the Click task
click(ui.leasetracker.lease-record-row);
// Step 3: Click the Renew Lease custom action button using the Click task
click(ui.leasetracker.renew-lease-button);
// Step 4: Confirm the Tenant Name field on the Lease Renewal form is pre-filled with the correct value
assertValue(ui.leasetracker.tenant-name-field, "Morgan Blake", errorhandling.STOP_ON_ERROR);Before using the Assert Value task, ensure that you've learned how to confirm text on a page using the Assert Text task.