Skip to main content

Run JavaScript function on web page

Sophie avatar
Written by Sophie
Updated over 2 weeks ago

Definition and Usage

Run JavaScript function on the web page and get the returned result. This command allows you to execute custom JavaScript code directly on a loaded web page and capture any values returned by the function.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Web page

Select a variable that contains the web page to work with

Yes

Must be a valid web page object from previous browser operations

JavaScript function

Enter the JavaScript to function to run on web page

Yes

The function should be properly formatted JavaScript code that can run in a browser context

Store result into

Save the JavaScript result into a new variable

Yes

This will store any returned value from your JavaScript function

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action produces a variable that contains the result returned by the JavaScript function executed on the web page.


Using Variables in Conditions

You can use variables in the parameters by clicking the variable icon or typing {variableName}. This allows you to dynamically set the web page to work with or construct JavaScript code using values from previous steps in your workflow.


Notes

  • The JavaScript function must be valid and properly formatted to execute correctly in the browser context.

  • The function should include a return statement if you want to capture a value in the output variable.

  • Common uses include extracting data from web pages, modifying web page content, or triggering client-side actions.

  • JavaScript execution is subject to the same security restrictions as any code running in the browser.

  • If the JavaScript function throws an error, the command will fail according to your error handling settings.

Did this answer your question?