Open URL task | Zoho QEngine Help

Open URL

In a nutshell

The Open URL task loads a specified URL in the browser, allowing your test to start from a specific page or navigate to another page during execution. The URL can be given directly as a string or stored in a variable, and opened in the same window, a new tab, or a new window depending on the test's requirement.

1. Overview

The Open URL task navigates the browser to a specified web page during test execution. It can be used at any point in a test flow to load whichever page the test needs for the interactions it performs, without relying on clicks or other navigation actions. Every web test needs a page loaded before any other task can run against it, which makes this typically the starting point of a script.
NotesNote: QEngine launches a separate browser session to run the test, distinct from the browser you use to build the test case. This session may be visible or headless depending on your run configurations
Depending on the test scenario, the URL can be opened in one of the following window types:
  1. Same window - Loads the URL in the window already running the test, replacing the page already open. Use this when the test continues on the newly loaded page.
  2. New tab - Opens the URL in a new browser tab while keeping the current tab open. The new tab becomes the active context immediately, so any task that runs right after it such as, a read, a click, anything, acts on the new tab, not the one that was open before. Suited to tests that need to switch between multiple pages during execution.
  3. New window - Launches the URL in a separate browser window while leaving the original window unchanged. The new window becomes active immediately the same way a new tab does. Applies to test workflows that require interacting with multiple browser windows independently.

2. Syntax

openURL(<URL>, <window_type>);

ParameterData TypeDescription
URLSTRING

URL of the website that will be opened.


Notes
Note:
  1. The URL must be a valid, complete web address, including the protocol (http:// or https://) and a valid domain, for example https://www.zoho.com.

  2. The task fails and terminates the test case if the URL doesn't open within three seconds.
window_typeSTRING

The type of window in which the URL will be opened.

Applicable values:
same window - Opens the URL in the window the test is already running in.
new tab - Places the URL in a browser tab created alongside the current one.

new window - Directs the URL to a browser window separate from the current one.

NotesNote: When a test case is recorded, the default window type selected is "same window."

3. Examples

Example 1: Opening the home page and signing in
This script opens the Zylker Watches home page in the same window, followed by a click on the Sign In link to reach the login page.

// Step 1: Open the Zylker Watches home page on the ZWatch Commerce website in the same window
openURL("https://zwatch.zohocommerce.com/", "same window");
// Step 2: Click the Sign In link using the Click task
click("a[href='/signin']");

where:

"https://zwatch.zohocommerce.com/"URL of the Zylker Watches home page on the ZWatch Commerce website.
"same window"Opens the home page in the window already running the test.
"a[href='/signin']"Locator for the Sign In link on the home page.


Example 2: Comparing two product pages in a new tab
The following script Compares prices across two open tabs, and checks that the Daytona and Diver Chronomat pages show different prices after opening the second in a new tab.
// Step 1: Open the Diver Chronomat product page on the ZWatch Commerce website in the same window
openURL("https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722", "same window");
// Step 2: Open the Daytona product page in a new tab, leaving the Diver Chronomat tab open
openURL("https://zwatch.zohocommerce.com/products/daytona/3531661000000075692", "new tab");
// Step 3: daytonaPrice stores the price text read from the Daytona page using the Get Text task
daytonaPrice = getText("span[data-zs-selling-price]");
// Step 4: Switch back to the Diver Chronomat tab using the Switch To task
switchTo(ui.zwatch.diver-chronomat-tab);
// Step 5: Confirm the Diver Chronomat price differs from the stored Daytona price using the Assert Text task
assertText("span[data-zs-selling-price]", daytonaPrice, errorhandling.CONTINUE_ON_ERROR);

where:

"https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722"URL of the Diver Chronomat product page.
"same window"Opens the Diver Chronomat page in the window already running the test.
"https://zwatch.zohocommerce.com/products/daytona/3531661000000075692"URL of the Daytona product page.
"new tab"Opens the Daytona page in a new tab, leaving the Diver Chronomat tab open.
daytonaPriceVariable storing the price text read from the Daytona page.
span[data-zs-selling-price]Locator pattern for the selling price element on a ZWatch Commerce product page.
ui.zwatch.diver-chronomat-tabStored reference for the tab holding the Diver Chronomat page.
errorhandling.CONTINUE_ON_ERRORContinues the test and returns the comparison result instead of stopping if the prices don't differ.

Example 3: Opening a URL returned by a function
This function returns a constructed product URL, which Open URL then loads in a new window rather than a hardcoded string.
// Step 1: productURL holds the URL returned by the shopping module's get_product_url function
productURL = shopping.get_product_url("daytona");
// Step 2: Open the returned URL in a new window
openURL(productURL, "new window");

where:

productURLVariable storing the URL returned by the shopping module's get_product_url function.
shopping.get_product_url("daytona")Function call that returns the constructed URL for the Daytona product page.
"new window"Opens the returned URL in a separate browser window.


Example 4: Opening a report in a Zoho Creator application
This script opens the Pending Vendor Requests report in the Vendor Compass application, built on Zoho Creator, and approves a pending request using the Click task.
// Step 1: Open the Pending Vendor Requests report in the Vendor Compass application
openURL("https://creatorapp.zoho.com/zylker/vendor-compass#Report:Pending_Vendor_Requests", "same window");
// Step 2: Approve the pending vendor request using the Click task
click(ui.vendorcompass.approve-button);

where:

"https://creatorapp.zoho.com/zylker/vendor-compass#Report:Pending_Vendor_Requests"URL of the Pending Vendor Requests report in the Vendor Compass application.
"same window"Opens the report in the window already running the test.
ui.vendorcompass.approve-buttonStored locator for the approve control on the report.

4. Use cases

Scenario 1: Starting a checkout test from an already-authenticated session

Online stores that support persistent login expect returning customers to move straight into checkout without logging in again, as long as their session is still valid.

A tester needs to confirm this experience holds up. The test opens the store, restores a session captured during an earlier login test using Set Cookie, and proceeds directly to checkout. If session restoration failed silently, the customer would be forced through a full login again, adding friction that could cause cart abandonment.

Steps

  1. Open the Zylker Watches home page in the same window.
  2. Restore the previously captured session using the Set Cookie task.
  3. Navigate to the Diver Chronomat product page.
  4. Add the product to the cart.

Implementation

// Step 1: Open the Zylker Watches home page on the ZWatch Commerce website in the same window
openURL("https://zwatch.zohocommerce.com/", "same window");
// Step 2: savedSession holds the cookie values captured during an earlier login test, reused here to skip logging in again
savedSession = "authToken=98213xyz; sessionid=xyz789";
// Step 3: Restore the saved session into the browser using the Set Cookie task
setCookies("zwatch.zohocommerce.com", "savedSession");
// Step 4: Navigate to the Diver Chronomat product page using the Click task
click("a[href*='diver-chronomat']");
// Step 5: Add the product to the cart using the Click task
click(".theme-product-qty-and-add-cart");

Scenario 2: Comparing two product prices side by side

Shoppers comparing similar watch models often want two product pages open at once, without losing their place on the page they started on.

A tester needs to confirm this comparison workflow holds up: opening a second product in a new tab while the original stays open, then verifying the two prices actually differ. If opening a new tab instead replaced or lost the original page, comparison shopping would break for the customer.

Steps

  1. Open the Diver Chronomat product page in the same window.
  2. Open the Daytona product page in a new tab.
  3. Read the price shown on the Daytona page.
  4. Switch back to the Diver Chronomat tab and confirm its price differs.

Implementation

// Step 1: Open the Diver Chronomat product page on the ZWatch Commerce website in the same window
openURL("https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722", "same window");
// Step 2: Open the Daytona product page in a new tab, leaving the Diver Chronomat tab open
openURL("https://zwatch.zohocommerce.com/products/daytona/3531661000000075692", "new tab");
// Step 3: daytonaPrice stores the price text read from the Daytona page using the Get Text task
daytonaPrice = getText("span[data-zs-selling-price]");
// Step 4: Switch back to the Diver Chronomat tab, since the Daytona tab became active when it opened
switchTo(ui.zwatch.diver-chronomat-tab);
// Step 5: Confirm the Diver Chronomat price differs from the stored Daytona price using the Assert Text task
assertText("span[data-zs-selling-price]", daytonaPrice, errorhandling.CONTINUE_ON_ERROR);

Scenario 3: Reviewing customer history without losing an open work order

A field service organization uses a Zoho Creator Field Service Management application to manage customer work orders, assign technicians, and track service history. Before assigning a technician to a new work order, support staff review the customer's previous service visits to understand recurring issues, warranty status, and past maintenance records.

A tester uses Zoho QEngine to automate this validation. The test confirms that opening the customer history dashboard in a new window lets the tester review service history without interrupting or losing the work order already open in the original window, then returns to that window to continue processing the request.

Steps

  1. Open the Work Order form in the Zoho Creator Field Service Management application.
  2. Open the Customer History dashboard in a new browser window.
  3. Verify the work order remains open in the original window.
  4. Review the customer's previous service visits in the new window.
  5. Switch back to the original window and continue processing the work order.

Implementation

// Step 1: Open the Work Order form in the Zoho Creator Field Service Management application
openURL("https://creatorapp.zoho.com/zylker/field-service-management#Form:Work_Order", "same window");
// Step 2: Open the Customer History dashboard in a new browser window
openURL("https://creatorapp.zoho.com/zylker/field-service-management#Page:Customer_History", "new window");
// Step 3: Switch back to the original browser window
switchTo(ui.fieldservice.work-order-window);
// Step 4: Continue processing the work order
click(ui.fieldservice.assign-technician);

5. Points to note

  1. The task fails and terminates the test case if the URL doesn't open within three seconds.
  1. Same window, new tab, and new window all apply inside the separate browser session QEngine opens for the test run, not the browser you're using to view or build the test case itself.
  1. Avoid using Open URL repeatedly within the same flow. Reloading the page resets its context, which can break locators captured before the reload. Use Switch To to move between existing windows, tabs, or frames, and use Back or Forward to move within the browser's history, instead of reaching for Open URL again.
  2. Use Get Cookie to capture the session state right after logging in, then pair it with Set Cookie to restore that session across test cases, skipping a full sign-in flow each time. When the same open-and-restore sequence repeats across multiple test cases, wrap those steps in a Function so the whole sequence can be called by name instead of retyping it.

6. Related topics

  1. Click
  2. Set Value
  3. Assert Text
  4. Wait
  5. Switch To
  6. Forward
  7. Back
  8. Get and set cookie support in Zoho QEngine

7. What's next

Previous step

Before using the Open URL task, ensure that you've created your test case and understand what <web testing> is in QEngine.


Next step

Now that you've used the Open URL task to navigate to a URL, learn how to interact with an element on the page using the Click task.