История страницы
...
Execute script Version 11 (Java)
Группа действий: Браузеры Подгруппа Окна, вкладки, фреймы
Описание
Действие выполняет скрипт в браузере (используются скрипты JavaScript)
Иконка действия
Параметры
Входные параметры
Контекст Контекст действия для работы с браузером
Скрипт Скрипт, который должен быть выполнен в браузере
Параметры Параметры, передаваемые в скрипт
Выходные параметры
Результат Результат выполнения скрипта
Настройки
...
Контекст действия для работы с браузером
...
Идентификатор сеанса браузера
...
Контекст браузера
...
Да
...
Коллекция
Строка
Число
Логический
...
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:
A message from the browser window is displayed on the screen
...
Результат выполнения скрипта
...
Объект
Особые условия использования
Отсутствуют
Пример использования
Задача
Открыть браузер и вывести окно "This page says" с помощью скрипта. Затем получить текст из окна "This page says" и вывести его сообщением на экран.
Реализация
- Собираем следующую схему робота:
- Настраиваем параметры действия “Открыть браузер”:
- Настраиваем параметры действия “Выполнить скрипт”:
В поле скрипта задаем параметры как
Это нужно, потому что параметры скрипта забираются из переменной arguments.Блок кода arguments[0]
В параметрах скрипта выбираем переменную типа "Строка" и прописываем значение "Hello World!". - Настраиваем параметры действия “Получить текст окна диалога”:
- Настраиваем параметры действия “Сообщение”:
- Запускаем робота.
Результат
Робот отработал успешно:
На экран выведено сообщение из окна браузера: