Run JavaScript function on web page Action(Power Automate Desktop)

Japanese version.

This action executes JavaScript code.

This action targets the browser invoked by the following action.

How to use

Drag "Run JavaScript function on web page" under "Browser automation".

Set parameters.


Web browser instance

Specify the browser (Variables produced by the startup action) in which to execute Javascript.

JavaScript function

Specify the JavaScript code to be executed.

The initial state is as follows.

To execute a function (function) called ExecuteScript, In this, specify any code, and finally the value to be returned to Power Automate Desktop in the return clause.

The result returned in the return clause is stored in Variables produced.

function ExecuteScript() {
  return "Value returned to Power Automate Desktop.";

The following will display the "Execute" dialog in the browser and return the string "Done" to Power Automate Desktop.
(The result variable is not necessary for this level of detail, but since there are many cases where a variable is prepared for the result, we will use it as a sample.)

function ExecuteScript() {
  let result = "Not completed";
  result = "Done";
  return result;

Power Automate Desktop variables are available in this (enclose variable names in %).

For those who want to learn Power Automate Desktop effectively

The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.


Browser automation Actions