Script class
Executes Script on RPA agent side, not in Сontrol Tower. The same as:
driver.executeScript(...)
Examples
GroovyScript
This example performs the following actions:
- Executes GroovyScript (sum operation) and stores result in the
result1variable - Executes GroovyScript with timeout. Action fails if execution time exceeds 31 seconds
Expand to see the example
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
scriptlang="groovy">
<robotics-flow>
<robot driver="desktop">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="true">
</export>
</config>
JavaScript
This example performs the following actions:
- Opens Selenium localhost page
- Executes JavaScript
- Stores script output in the
resultvariable
Expand to see the example
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
<robotics-flow>
<robot driver="universal">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="false">
</export>
</config>
AutoitScript
This example executes AutoitScript with timeout. Action fails if execution time exceeds 10 seconds.
Expand to see the example
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
<robotics-flow>
<robot driver="universal">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="true"></export>
</config>
GroovyScript with params
This example performs the following actions:
- Executes GroovyScript with timeout and additional parameters
- Returns script results to the
resultvariable
Expand to see the example
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
<robotics-flow>
<robot driver="desktop">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="true">
</export>
</config>
Script class methods
The Script class has the following methods.
| Type | Method | Description |
|---|---|---|
| static <T> T | executeAutoitScript(String code) | Executes AutoIt Script |
| static <T> T | executeAutoitScript(String code, long timeout) | Executes AutoIt Script with execution timeout |
| static <T> T | executeAutoitScript(String code, long timeoutInMillis, Object... args) | Executes AutoIt Script with execution timeout and additional arguments |
| static <T> T | executeGroovyScript(String code) | Executes Groovy Script |
| static <T> T | executeGroovyScript(String code, long timeoutInMillis) | Executes Groovy Script with execution timeout |
| static <T> T | executeGroovyScript(String code, long timeoutInMillis, ScriptParams arguments) | Executes Groovy Script with execution timeout and additional arguments |
| static <T> T | executeGroovyScript(String code, ScriptParams arguments) | Executes Groovy Script with additional arguments |
| static <T> T | executeJavaScript(String code, Object... args) | Executes JavaScript with additional arguments |