История страницы
...
Execute script Version 11 (Java)
Группа действий: Браузеры
Описание
Данное действие предназначено для выполнения скрипта в браузере (используются скрипты JavaScript).
Иконка действия
Параметры действия
Входные параметры:
Поле “Контекст” - Уникальный идентификатор открытого сеанса работы с браузером.
Поле “Скрипт” - Скрипт для выполнения в браузере.
Поле “Параметры” - Параметры, передаваемые в скрипт.
Выходные параметры:
Результат - Результат выполнения действия
Настройки
...
Уникальный идентификатор открытого сеанса работы с браузером.
...
Идентификатор сеанса браузера
ACTION_CONTEXT
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
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Context | Action context for working with the browser | Robin.Selenium | Browser context | Yes |
Script | Script to execute in browser | Robin.String | Yes | |
Script parameters | Parameters passed to the script | Robin.Object | No | |
Results | ||||
Result | Script execution result | Robin.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
- Assemble the following robot scheme:
- Set the parameters for the "Open Browser" action:
- Set the parameters of the "Execute script" action:
In the script field set the parameters as
This is necessary because the script parameters are taken from the arguments variable.Блок кода arguments[0]
In the script parameters, select a variable of the "String" type and write the value "Hello World!". - Set the parameters of the "Get the alert text" action:
- Set the parameters of the "Show Message" action:
- Start the robot.
Result
The robot completed successfully:
...
Да
...
Результат выполнения.
...
Объект
Особые условия использования
Отсутствуют.
Пример использования
Задача: Перейти на страницу https://ya.ru и вывести диалоговое окно в браузере с помощью скрипта. После закроем браузер используя действие “Закрыть браузер”.
Реализация:
- Собираем схему робота
- Настраиваем параметры действия “Открыть браузер”, “Выполнить скрипт”и “Закрыть браузер”.
- В Контексте указываем наш браузер и поле Скрипт указываем наш скрипт. (Используемый язык - JavaScript).
- Заполняем параметры действия “Закрыть браузер”.
После запускаем робота.
Результат
A message from the browser window is displayed on the screen: