Upload task | Zoho QEngine Help

Upload task

In a nutshell

The Upload task attaches a file to a file input element on a webpage. It supports file input elements configured to accept either a single file or multiple files. This task is commonly used to upload documents, images, or other file types during checkout, registration, or any workflow that requires a file attachment. The file is selected from the Files section in your QEngine project settings.

1. Overview

The Upload task adds a file to an input element that accepts file attachments. It can upload a file to a single-file input field or add a file to a multi-file input field. The task can automate workflows such as profile photo uploads, job application submissions, expense claim receipts, or identity verification documents.

In the process, testers can verify that the application accepts files correctly, validates upload requirements, and processes attached documents as expected.

Notes

Note:
Add the file to Files under Settings in your QEngine project before referencing it in an Upload task.

When multiple Upload tasks target the same web element, a single-file input field keeps only the most recently uploaded file. Whereas a multi-file input retains the existing files and appends the new file.

2. Syntax

upload(<locator>, files.<filename>);

ParameterData TypeDescription
locatorSTRINGIdentifies the file input element to upload to.
NotesNote: 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
filenameOBJECTName of the file to be uploaded, referenced from the Files section.
NotesNote: Files are added and managed from Files inside Settings for each project.

3. Examples

Example 1: Uploading a product image on a seller listing page

Uploads a product image file to the image upload field on a seller listing page, using a file stored in the project's Files section.

// Open the seller listing page on the ZWatch Commerce website using the Open URL task
openURL("https://zwatch.zohocommerce.com/seller/new-listing", "same window");
// Upload the product image using the Upload task
upload(ui.zwatch.product-image-upload, files.Daytona_Front_View);

where:

"https://zwatch.zohocommerce.com/seller/new-listing"Seller listing page URL.
"same window"Opens the page in the window already running the test.
ui.zwatch.product-image-uploadStored locator for the image upload field.
Daytona_Front_ViewName of the file referenced from the Files section.

Example 2: Attaching a resume to a job application and confirming it's accepted

Uploads a resume file to the resume field on a careers page, then confirms the file name appears as a visible confirmation that it uploaded successfully.

// Open the careers application page on the ZWatch Commerce website using the Open URL task
openURL("https://zwatch.zohocommerce.com/careers/apply", "same window");
// Upload the resume file using the Upload task
upload(ui.zwatch.resume-upload-field, files.Applicant_Resume);
// Confirm the uploaded file name appears using the Assert Text task
assertText(ui.zwatch.uploaded-file-name, "Applicant_Resume.pdf", errorhandling.STOP_ON_ERROR);

where:

"https://zwatch.zohocommerce.com/careers/apply"Careers application page URL.
"same window"Opens the page in the window already running the test.
ui.zwatch.resume-upload-fieldStored locator for the resume field.
Applicant_ResumeName of the resume file referenced from the Files section.
ui.zwatch.uploaded-file-nameStored locator for the uploaded file name shown after a successful upload.
errorhandling.STOP_ON_ERRORStops the test if the file name doesn't appear as expected.

Example 3: Attaching a sales order to a procurement form in a Zoho Creator application

Uploads a sales order file to the sales order field on a procurement form, built on Zoho Creator, using the Upload task.

// Open the procurement form in the Procurement application using the Open URL task
openURL("https://creatorapp.zoho.com/zylker/procurement#Form:Purchase_Request", "same window");
// Upload the sales order file using the Upload task
upload(ui.procurement.sales-order-field, files.Sales_Order_4521);

where:

"https://creatorapp.zoho.com/zylker/procurement#Form:Purchase_Request"Procurement form URL.
"same window"Opens the form in the window already running the test.
ui.procurement.sales-order-fieldStored locator for the sales order field.
Sales_Order_4521Name of the file referenced from the Files section.

Example 4: Attaching multiple files to a multi-file upload field

Two supporting documents get attached to the same upload field, one call per file, since the field accepts more than one attachment at once.

// Open the page using the Open URL task
openURL("https://www.<website_name>.com/<page_name>", "same window");
// Upload the first supporting document using the Upload task
upload(ui.<page_name>.<element_name>, files.ID_Proof);
// Upload a second supporting document to the same field using the Upload task
upload(ui.<page_name>.<element_name>, files.Address_Proof);

where:

"https://www.<website_name>.com/<page_name>"Page URL.
"same window"Opens the page in the window already running the test.
ui.<page_name>.<element_name>Locator for the supporting documents field, built to accept multiple files.
ID_ProofName of the first file, referenced from the Files section.
Address_ProofName of the second file, added alongside the first rather than replacing it.

4. Use cases

Scenario 1: Verifying a product listing can be published after uploading a required image

Online marketplaces typically require at least one product image before a seller can publish a new listing, since customers rely on product photos to evaluate what they are buying.

A tester uses Zoho QEngine to automate this validation. The test first confirms that attempting to publish a listing without an image is blocked with a validation error. It then uploads the required product image and verifies that the listing can be published successfully. If the validation failed, sellers could either publish listings without images or be prevented from publishing even after uploading a valid image.

Steps

  1. Open the seller listing page in the same window.
  2. Fill in the listing details without uploading an image.
  3. Attempt to publish the listing.
  4. Confirm the missing-image error message appears.
  5. Upload the required product image.
  6. Publish the listing again.
  7. Confirm the listing is published successfully.

Implementation

// Step 1: Open the seller listing page on the ZWatch Commerce website in the same window using the Open URL task
openURL("https://zwatch.zohocommerce.com/seller/new-listing", "same window");
// Step 2: Enter the product title using the Set Value task
setValue(ui.zwatch.product-title-field, "Vintage Diver Watch");
// Step 3: Attempt to publish the listing without an image using the Click task
click(ui.zwatch.publish-listing-button);
// Step 4: Confirm the missing-image error message appears using the Assert Visible task
assertVisible(ui.zwatch.image-required-error, errorhandling.CONTINUE_ON_ERROR);
// Step 5: Upload the product image using the Upload task
upload(ui.zwatch.product-image-upload, files.Daytona_Front_View);
// Step 6: Publish the listing again using the Click task
click(ui.zwatch.publish-listing-button);
// Step 7: Confirm the listing is published successfully using the Assert Visible task
assertVisible(ui.zwatch.listing-published-confirmation, errorhandling.STOP_ON_ERROR);

Scenario 2: Replacing an outdated resume before submitting a second application

Job seekers sometimes need to reapply with an updated resume after realizing the one they submitted was outdated.

A tester uses Zoho QEngine to automate this validation. The test confirms that uploading a second resume to the same field replaces the outdated one, reflecting only the newer file name on the form. If the validation failed, the applicant's outdated resume could still reach the hiring team.

Steps

  1. Open the careers application page in the same window.
  2. Upload the outdated resume file.
  3. Upload the updated resume file to the same field.
  4. Confirm the form reflects only the updated file name.

Implementation

// Step 1: Open the careers application page on the ZWatch Commerce website in the same window using the Open URL task
openURL("https://zwatch.zohocommerce.com/careers/apply", "same window");
// Step 2: Upload the outdated resume file using the Upload task
upload(ui.zwatch.resume-upload-field, files.Applicant_Resume_Old);
// Step 3: Upload the updated resume file to the same field using the Upload task
upload(ui.zwatch.resume-upload-field, files.Applicant_Resume_Updated);
// Step 4: Confirm only the updated file name is shown using the Assert Text task
assertText(ui.zwatch.uploaded-file-name, "Applicant_Resume_Updated.pdf", errorhandling.STOP_ON_ERROR);

Scenario 3: Attaching a required receipt before an expense claim can be submitted

Consider a finance organization that uses a Zoho Creator Expense Tracker application to manage employee reimbursements. The Expense Claim form includes a receipt upload field, and expense claims above a certain amount require a receipt attached there before the form can be submitted for approval.

A tester uses Zoho QEngine to automate this validation. The test confirms that the form can't be submitted without a receipt, uploads the receipt, and confirms the file was accepted before submitting. If the validation failed, expense reports could be submitted without the required supporting documents, or a receipt could silently fail to attach without anyone noticing.

Steps

  1. Open the Expense Claim form in the Expense Tracker application.
  2. Attempt to submit the form without a receipt.
  3. Confirm the missing-receipt error appears.
  4. Upload the receipt file to the receipt field.
  5. Confirm the receipt file name appears.
  6. Submit the form and confirm it's accepted.

Implementation

// Step 1: Open the Expense Claim form in the Expense Tracker application using the Open URL task
openURL("https://creatorapp.zoho.com/zylker/expense-tracker#Form:Expense_Claim", "same window");
// Step 2: Attempt to submit the form without a receipt using the Click task
click(ui.expensetracker.submit-button);
// Step 3: Confirm the missing-receipt error appears using the Assert Visible task
assertVisible(ui.expensetracker.receipt-required-error, errorhandling.CONTINUE_ON_ERROR);
// Step 4: Upload the receipt file to the receipt field using the Upload task
upload(ui.expensetracker.receipt-field, files.Taxi_Receipt);
// Step 5: Confirm the receipt file name appears using the Assert Text task
assertText(ui.expensetracker.uploaded-file-name, "Taxi_Receipt.pdf", errorhandling.STOP_ON_ERROR);
// Step 6: Submit the form and confirm it's accepted using the Click and Assert Visible tasks
click(ui.expensetracker.submit-button);
assertVisible(ui.expensetracker.submission-confirmation, errorhandling.STOP_ON_ERROR);

5. Points to note

  1. Add the file to Files under Settings in your QEngine project before referencing it in the Upload task.
  2. The Upload task attaches the file directly to the file input element. It cannot interact with native operating system file picker dialogs.
  3. Prefer logical locators, such as field labels or names, over raw full XPath strings when locating the file input element.
  4. When multiple Upload tasks target the same web element, a single-file input replaces the previously selected file with the latest upload. While a multi-file input preserves the existing files and appends the newly uploaded file.
  1. Select
  2. Check
  3. Uncheck
  4. Clear

7. What's next

Next step
Previous
Next step
Now that you've learned about Form Actions, learn how to write test cases using the web testing recorder or the web testing builder and editor.
Previous

Before using the Upload task, it helps to know how the other Form Actions tasks such as Select, Deselect, Check, Uncheck, and Clear work.