1. Tasks
  2. Virtual Worker Task

Tasks

Virtual Worker Task

Executes a set of virtual browser worker commands to perform automated actions

See virtual-worker concept for more details.

Basic usage

Run a virtual worker that navigates to a website and types text into a field.

loading...

Parameters

worker
Object
required

Defines the execution settings and commands for the virtual worker.

Show child attributes
group
string
optional

Optional group (classification) of virtual worker to use.
This can be used to reuse a specific virtual worker for multiple tasks and across stubs.

timeout
Object
Show child attributes
seconds
Number
optional

Maximum time in seconds to allow the worker to run before terminating it.

Default: 60


commands
Object
required

A set of commands to execute by the virtual worker.
Each command is defined as a key-value pair, where the key is a unique identifier for the command, and the value is an object defining the command type and its parameters. See more below.

IMPORTANT :
Each command must have a unique __order parameter to define the execution order.


Supported Command Types

Browser Write text

Will write the specified text into the element located by the locator.

loading...

Browser Navigate

Will navigate the browser to the specified URL.

loading...

Browser Click

Will click on the element located by the locator.

loading...

Browser Press Key

Will press the specified key in the focused element.

loading...

Browser Get Local Storage

Will retrieve the entire local storage of the browser. Depends on the website what data is stored there.

loading...

Browser Extract Data

Will extract data from the page using the specified locators.
Converts HTML elements into structured JSON data.

loading...

Specifying a string as the value of a locator will extract the text content of the element.

Specifying an object as the value of a locator allows for more complex extraction, including lists and attributes.

To extract a list of elements, use the special key _list with a locator string that will match multiple elements. To extract properties of each list item, use the special key _list_item_properties with an object defining the properties to extract.

To extract an attribute of an element, use the special keys _locator and _target within a locator object.

Browser Screenshot

Will take a screenshot of the current page or of the given locator.

loading...

params.locator (optional): A locator string to capture a specific element's screenshot.

params.screenshot_options (optional) parameter can be used to specify additional options for the screenshot.
Supports all options from Playwright's page.screenshot() method.

Notably:

  • fullPage (boolean): When true, takes a screenshot of the full scrollable page. Default is false.
  • clip (object): An object specifying the clipping region of the screenshot with properties x, y, width, and height.

Returns

loading...

Browser Extract HTML

Will extract the HTML content of the current page or of the given locator.

loading...

params.locator (optional): A locator string to extract HTML from a specific element.

Returns

loading...

Download Files

Integrates with the Stubber file storage system to download files by their UUIDs.
Specify either an array of strings (fileuuids) or an array of objects with a fileuuid property.

Files are downloaded to the default tmp directory on the virtual worker machine.

loading...

Upload Files

Uploads files from the virtual worker machine to the Stubber file storage system.
Specify an array of file paths to be uploaded.
Resulting fileuuids are available in the command payload if successful.

loading...

Locators

Locators are used to identify and interact with elements on a web page. They can be defined using various strategies, such as CSS selectors, XPath expressions, or text content. See locators documentation for more details and examples.