After maximizing the Script Center () and loading the script () you have previously recorded, you will see the following interface:
1 Edit Script
The Script Center consists of two tabs. The first tab (Edit Script) shows you the recorded steps of your script.
Steps are indexed and executed in the index order. You can stop the script execution at any moment and see the next step marked with a green border.
2 Execution Summary
The second tab of the Script Center shows the steps taken and the variables used in those steps.
If a script step fails, you will see the error on the screen and the error log within the execution summary for the failed step.
The Step card represents a command that is recorded or added manually. It contains a type name, description, arguments, and post actions.
Not all commands contain or require arguments or post actions.
Arguments contain variables that need to be passed to the command that is being executed. For example, a click command needs position information, button information, modifier information, and type information.
timeoutMs: You can set the timeout for the selected step. This attribute is useful when a step might take some time to execute, so by increasing the timeout value, the step has a greater chance of running successfully.
3.2 Post Actions
After a command is executed, the post-action command takes place. The most common post action is Delay, and it is used when you need to wait for an element to appear for the action to be completed.
All these post actions can be added through the Step options menu (3 dots).
3.3 Step Options
You can access the step options by clicking the three dots in the top-right corner or by right-clicking on the step. This menu contains many functions for manipulating the steps. For example, adding steps before or after the selected step, adding post actions, moving the step vertically in the list, and deleting the step.
Available options are listed in the following table:
|Play to Step||Begins playing the script and stops at this step. It does not start playing from the beginning.|
|Jump to Step||Sets the active step to this step. Pressing play will begin the playback from this step to the script end.|
|Add Step Above||Manually insert a step above this step (refer to the list of available steps below).|
|Add Step Below||Manually insert a step below this step (refer to the list of available steps below).|
|Move Step||Using a dialog you can move a step up or down in the script. You can also use the mouse to drag steps into new positions by dragging the step by its number.|
|Add Delay||Inserts a delay to the script (will be disabled if already present);
We can add delay to every action or it can be the action itself. It is suggested to add a 250ms delay to all actions except those that lead to page reloading and where it does not make sense. Delay should be used as a sort of protection due to the internet connection speed and speed of the website where we run the script. Another scenario is when something requires loading time, for example, filling the drop-down menu. In this case, we have to add delay to enable the server to load drop-down options. You can watch a short video here.
|Set Variable||Change the value of a script variable for this step.|
Here you can use the scriptRunner function in two ways:
– scriptRunner.nextStep = ‘3’ – use to set the next step to be executed based on the step number;
– scriptRunner.nextStepLabel = ‘sectionHardware’; – use to set the next script step based on the GOTO label of the step;
|Delete||Deletes the step. This action can not be undone.|
4 Script Control Bar
This element contains common features for creating, saving, managing and editing the script source code.
From this bar, you can also play back your recorded script. Before playing back your script, click Reset Playback so that the script plays from the beginning. Additionally, you can also replay step by step by using the Step button.
The following step types are available and can be added from the Script Center. You can see them in action in this video.
Delay actions should be used to create time space between other actions. When we work with asynchronous actions e.g. fetching data, reloading page, or waiting for dropdown options to load we have to use the delay to prevent other steps to start before asynchronous action is finished.
Delay action accepts one argument:
– ms: the time, in milliseconds, that the step should wait before the next is executed;
Set error handler
This action is in charge of handling server action errors. The parameter of this action is the goto label. When an error occurs, the script is going to jump to that step. This action can be useful in situations when a user wants to execute a set of actions that can generate errors.
– handlerStepLabel: Goto label of the action which is going to execute after an error;
Go to step is used to jump to a specific script step before or after the current one.
– stepLabel: Goto label of another element we want the script to jump to;
Server action is a step that allows calling external API or executing SQL queries. This action can be used to save values in the database or send values to the external server.
– serverAction: This value refers to the previously created action. Server actions can be created from the Database or Web Data connections.
Switch to page
Switch to page action allows the user to switch pages while running the script. This action has the possibility to send page variables from one page to another. To create this action, the user has to go through the configuration and select desired options.
Get with JQuery selector
This action is used by pressing CTRL + C on the keyboard. After creating this action, we can choose the name of the variable where we want to keep that value.
Set with JQuery selector
This action is used by pressing CTRL + V into the selected input field. After creating this action, we can choose which value we want to pass to that input in the Script Center.
– value: value that is going to be passed to that element;
|Selectors, value, dispatchEvent||No||Yes|
Wait for element to load
This action waits for the selected element to be loaded and fully available on the page. It is useful when going to another page or loading a part of the page.
Click with JQuery selector
This action is usually created from the recorder. In some situations, you cannot capture mouse click, so an alternative way to capture it is to navigate the pointer over the element you want to click and press the backtick key (key under the escape button on the keyboard).
– keyModifiers: list of key modifiers that can be dispatched during this action;
Keypress with JQuery element
This action sends a specific key code to the selected element.
– keyData: keycode the user has pressed;
Get text from element
This action evaluates the selected element and saves its value. This action is usually created in the recorder.
– Set variable: Evaluated value will be stored in the selected script variable;
JS eval with element
edgeCore version: 4.4.1
When you load the recorded script, you can disable any step by turning off the toggle switch. This is useful for testing different versions of the steps.
For example, in this video, we have disabled the last step in our script — click on the Register button to submit user information.