История страницы
...
Switch to frame Version 13 (Java)
Группа действийAction group: БраузерыBrowsers
Описание
Действие выполняет переключение фокуса управления на текущей странице на заданный фрейм . Фрейм - отдельный, законченный HTML-документ, который вместе с другими HTML-документами может быть отображён в окне браузера. Внутрь фрейма могут быть также вложены фреймы, и в них тоже могут быть вложены фреймы. Фреймы разбивают веб-страницу на отдельные миникадры, расположенные на одном экране, которые являются независимыми друг от друга. Каждое окно может иметь собственный адрес.
Web-элементы, которые находятся внутри фрейма, расположенного на web-странице, изолированы от элементов, находящихся на самой странице и элементов внутри других фреймов страницы. Элементы внутри фрейма будут недоступны для работы с ними с помощью действий до тех пор, пока не будет выполнено переключение на этот фрейм.
Для более глубокого понимания структуры фреймов и принципов их построения, рекомендуем ознакомиться с информацией по ссылкам ниже:
...
Description
The action switches the control focus on the currently active page to the specified frame. A frame is a separate, complete HTML document that, together with other HTML documents, can be displayed in a browser window. Frames can also be nested within a frame, and frames can also be nested within frames. Frames divide a web page into separate minicomics on the same screen, which are independent of each other. Each window can have its own address.
Web elements that are inside a frame located on a web page are isolated from elements on the page itself and elements inside other frames on the page. Elements within a frame are not available to be manipulated by actions until you switch to that frame.
For a deeper understanding of the structure of frames and the principles of their construction, read the information on the links below:
Информация |
---|
More on frames |
Информация |
Подробнее о фреймах: https://osipenkov.ru/iframe-tracking-gtm/ https://ru.wikipedia.org/wiki/%D0%A4%D1%80%D0%B5%D0%B9%D0%BC_(HTML) https://www.tutorialspoint.com/html/html_frames.htm Пример схемы робота при переключении между фреймамиAn example of a robot scheme when switching between frames: Frames (1).robin-source |
Технически, действие перемещает фокус управления по структуре фреймов. Для этого необходимо указать целевой фрейм, в который нужно перейти, и область поиска этого фрейма.
Иконка
Настройки
Technically, the action moves the control focus through the frame structure. This is done by specifying the target frame to move to and the search area of that frame.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Context | Action context for working with the browser |
Свойство
Описание
Тип
Пример заполнения
Обязательность
заполнения поля
Параметры
Контекст
. | Robin.Selenium |
Browser context |
Yes |
Элемент
Имя
Имя фрейма
Element | Frame as an element for interaction | Robin.WebElement |
Нет
No | |
Name | Frame name |
Robin.String |
No |
Нет
Индекс
Index | Frame index. Numbering starts from 0. | Robin.Numeric |
No |
Нет
Область поиска фрейма
Frame search area | Frame search area. There are 3 options available: current frame - search within the current frame; parent frame - search within the parent frame; entire page - search within the entire page. | Robin.String |
Нет
Особые условия использования
- При работе с элементами страницы элементы фрейма недоступны. Для того, чтобы обратиться к элементам фрейма, на него необходимо переключиться.
- При работе с элементами фрейма элементы страницы недоступны. Для того, чтобы продолжить работу с элементами страницы, необходимо переключиться с фрейма обратно на страницу.
- Повторно перейти на текущую вкладку возможно также с помощью действия "Переключиться на вкладку".
- Чтобы определить количество фреймов на странице и их атрибуты, необходимо использовать консоль разработчика, . Консоль открывается нажатием клавиши F12 в браузере, где отображается iframe (если он имеется на странице).
Страница браузера с открытой консолью разработчика:
No |
Special conditions of use
You can select and fill one of the optional parameters;
Frame elements are not available when working with page elements. In order to access the frame elements, you must switch to the frame;
When working with frame elements, page elements are not available. In order to continue working with page elements, you need to switch from the frame back to the page;
You can also switch back to the current tab using the "Switch to Tab" action;
To determine the number of frames on the page and their attributes, you need to use the developer console. The console is opened by pressing the F12 key in the browser where the iframe is displayed (if there is one on the page).
Browser page with the developer console open:
As part of the example of filling out the "Frame search area" field, consider a site with frames: В рамках примера заполнения поля "Область поиска фрейма" рассмотрим сайт с фреймами: https://www.tutorialspoint.com/html/html_frames.htm , а также схему робота , as well as the robot scheme Frames (1).robin-source
Пример использования действия с использованием параметров "Индекс" и опций параметра "Область поиска":
Задача 1
Реализовать действия с использованием параметров "Индекс" и опций параметра "Область поиска".
- Опция Родительский фрейм - будем искать во фрейме находящемся на уровень выше относительно текущего фокуса (фрейма), либо когда фокус находится на основной странице. На сайте 3 фрейма (можно посмотреть с помощью консоли разработчика). Для переключения на третий фрейм заполним параметры:
- Проставляем в поле "Индекс" значение 2, (нумерация фреймов начинается с нуля).
- В поле "Область поиска фрейма" указываем значение "Родительский фрейм".
- В поле "Контекст" указываем контекст открытого браузера,
- в поле "Область поиска фрейма" укажем значение "Родительский фрейм" (потому что сейчас фокус находится в основной странице)
...
Фрейм (на который переключились) содержит в себе два фрейма.
Example of use
Task 1
Implement actions using the "Index" parameter and "Frame search area" parameter options.
- The Parent frame option - we will search in a frame that is a level higher than the current focus (frame), or when the focus is on the main page. There are 3 frames on the site (you can see them using the developer console). To switch to the third frame, let's fill in the parameters:
- Specify "2" in the "Index" field (frame numbering starts with zero).
- Specify "Parent frame" in the "Frame search area" field.
- Specify the open browser context in the "Context" field.
- Specify "Parent frame" in the "Frame search area" field (as the focus is now on the main page)
The frame (the one switched to) contains two frames.
2. Опция Текущий фрейм - ищем фрейм в внутри текущего фрейма. Переключимся на фрейм с текстом 2. The Current frame option - search for a frame inside the current frame. Let's switch to the frame with the text "This is main page and content from any link will be displayed here". Это второй фрейм внутри текущего фрейма. Укажем параметры действия:
This is the second frame inside the current frame. Let's specify the action parameters:
- Specify the open browser context in the "Context" field.
- Specify 1 in the "Index" field (frame numbering starts with 0).
- Specify value "Current frame" in the "Frame search area" field (search for a child frame in the current frame
- в поле "Контекст" укажем контекст открытого браузера,
- в поле "Индекс" укажем значение 1 (нумерация фреймов начинается с 0),
- в поле "Область поиска фрейма" укажем значение "Текущий фрейм" (ищем дочерний фрейм в текущем фрейм).
Далее, с помощью действие "Получить текст" получим текст из фрейма (см. приложенную к описанию схему роботаNext, use the "Get Text" action to get the text from the frame (see attached robot scheme).
3. Опция Вся страница - выполним переключение фокуса из фрейма на основную страницу. Для этого указываем опцию "Вся страница" и контекст открытого браузера. Остальные параметры оставьте пустымиThe Entire page option - let's switch the focus from the frame to the main page. To do this, specify the "Entire page" option and the context of the open browser. Leave the other parameters empty.
Выполним действие "Получить текст" из основной страницы (см. приложенную к описанию схему роботаLet's run the "Get Text" action from the main page (see attached robot scheme).
...
Task 2
Зайти на сайт с фреймом Go to website with a frame https://www.w3schools.com/css/tryit.asp?filename=trycss_default, переключиться на него для дальнейшей работы с ним и получить текст из фрейма switch to it for further work with it and get the text from the "My First CSS Example" frame.
Реализовать действие с использованием параметров "ИмяImplement the action using the "Name", "ЭлементElement" и опций "Область поиска".
Решение
Воспользоваться действиями "Открыть браузер", "Переключиться на фрейм", "Получить текст".
Реализация
parameters and "Frame search area" parameter option.
Solution
Use the "Open browser", "Switch to frame", "Get text" actions.
Implementation
- Assemble a robot scheme with the actions.
- Set the "Open browser" action parameters.
- Set the "Switch to frame" action parameters.
- Set the "Get text" action parameters. In the "Element" field specify the element from which you want to get the text. More about creating elements in section:
- Собрать робота, состоящего из действий:
- Настроить параметр для действия "Переключиться на фрейм".
- Настроить параметры для действия "Получить текст". В поле "Элемент" необходимо указать элемент из которого необходимо получить текст. Подробнее о создании элементов в разделе: Create Web-elements
- Нажать на кнопку Click "Старт" в верхней панели.
Результат
Программный робот отработал успешно.
- Start" in the top panel.
Result
The program robot completed successfully.
In this case, if you disable the "Switch to frame" action, the item will not be found because the item is searched for in the current document, but the item itself is in a nested document.В данном случае, если отключить действие "Переключиться на фрейм", то элемент не будет найден, так как поиск элемента осуществляется в текущем документе, а сам элемент находится во вложенном.