Execute script Version 11 (Java)

Action group: Browsers Subgroup: Windows, tabs, frames


Description

The action is performed by a script in the browser (JavaScript scripts are used)

Action icon

Parameters and their settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextAction context for working with the browserRobin.SeleniumBrowser contextYes
ScriptScript to execute in browserRobin.String
Yes
Script parametersParameters passed to the scriptRobin.Object
No
Results
ResultScript execution resultRobin.Object

Special conditions of use

None.

Example of use

Task

Open a browser and display the "This page says" window using a script. Then get the text from the "This page says" window and display it as a message on the screen.

Implementation

  1. Assemble the following robot scheme:

  2. Set the parameters for the "Open Browser" action:
  3. Set the parameters of the "Execute script" action:

    In the script field set the parameters as
    arguments[0]
    This is necessary because the script parameters are taken from the arguments variable.
    In the script parameters, select a variable of the "String" type and write the value "Hello World!".
  4. Set the parameters of the "Get the alert text" action:
  5. Set the parameters of the "Show Message" action:
  6. Start the robot.

Result

The robot completed successfully:

 A message from the browser window is displayed on the screen:

  • Нет меток