Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Execute script Version 11 (Java)

Группа действий: Браузеры

Описание

Данное действие предназначено для выполнения скрипта в браузере (используются скрипты JavaScript).

Иконка действия

Image Removed

Параметры действия

Входные параметры:

Поле “Контекст- Уникальный идентификатор открытого сеанса работы с браузером.

Поле “Скрипт- Скрипт для выполнения в браузере. 

Поле “Параметры- Параметры, передаваемые в скрипт.

Выходные параметры:

Результат - Результат выполнения действия

Настройки

...

Уникальный идентификатор открытого сеанса работы с браузером.

...

Идентификатор сеанса браузера

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

Image Added

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:
    Image Added
  2. Set the parameters for the "Open Browser" action:
    Image Added
  3. Set the parameters of the "Execute script" action:
    Image Added
    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:
    Image Added
  5. Set the parameters of the "Show Message" action:
    Image Added
  6. Start the robot.

Result

The robot completed successfully:
Image Added

...

Да

...

Результат выполнения.

...

Объект

Особые условия использования

Отсутствуют.

Пример использования

Задача:  Перейти на страницу https://ya.ru и вывести диалоговое окно в браузере с помощью скрипта. После закроем браузер используя действие “Закрыть браузер”.

Реализация:

  1. Собираем схему робота
    Image Removed
  2. Настраиваем параметры действия “Открыть браузер”, “Выполнить скрипт”и “Закрыть браузер”.
    Image Removed
  3. В Контексте указываем наш браузер и поле Скрипт указываем наш скрипт. (Используемый язык -  JavaScript). 
    Image Removed
  4. Заполняем параметры действия “Закрыть браузер”.

Image Removed

После запускаем робота.

Результат:

Image Removed A message from the browser window is displayed on the screen:
Image Added