Вы просматриваете старую версию данной страницы. Смотрите текущую версию.

Сравнить с текущим просмотр истории страницы

« Предыдущий Версия 10 Следующий »

Get table Version 11 (Java)

Action group: Browsers


Description

The action gets tables to a variable

Action icon

Action parameters

Input parameters

"Context" field - the context of the action for working with the browser.

"Element" field - an element for interaction.

"With header" field - if the value is "true", the row with the table header will be highlighted separately.

"Remove empty" field - if the parameter value is true, empty rows/columns will be deleted.

"Remove duplicate header" field - if the value is "true", indexes will be added to the same column names in the header of the resulting table. The numbering starts from 1.

Output parameters

"Result" - the resulting variable with data in the form of a table.

Settings

Property

Description

Type

Example

Mandatory field

Parameters

Context

The context of the action for working with the browser

Robin.Selenium

Browser context

Yes

Element

An element for interaction

Robin.WebElement


Yes

With header

If the value is "true", the row with the table header will be highlighted separately and will not be included in the rows with the contents of the table that the action returns

Robin.Boolean

true

No

Remove empty

If the parameter value is true, empty rows/columns will be deleted

Robin.Boolean

true

No

Remove duplicate header

If the value is "true", indexes will be added to the same column names in the header of the resulting table. The numbering starts from 1

Robin.Boolean

true

No

Results

Result

The resulting variable with data in the form of a table

Robin.DataTable



Special conditions of use

The action is only applicable with the table type elements

For a "With header" checkbox:

Parameter workflow: If “true”, the action will save the first row of the source table into the header of the returned table value, i.e. it will not be a row with the table contents.
If “false”, the first row will leave the table content part and the header will use the default names - 1, 2, 3, etc.

Example:

Get the spreadsheet:

With this parameter enabled, the log will show "Columns: 3; rows: 2" because the first row of the taken area becomes a header with the column names "No.", "Title", and "Tests". These headings cannot be accessed as a row of data to read, but you can use the column names to access a specific cell or column (actions from the "Tables" group). If the option is off, the log will show "Columns: 3; rows: 3", the column names in the header will be "1", "2" and "3".

Для чекбокса "Убрать дубли заголовка"

  • При значении "false", названия столбцов останутся прежними
  • При значении "true", для каждого названия столбца полученной таблицы выполняется проверка:
    1. Есть ли в таблице еще столбец с таким же названием? Если нет, столбец пропускается, проверяется следующий. Если есть, то к названию текущего столбца добавляется индекс (нумерация начинается с 1).
    2. Для нового названия проверка повторяется. Но если теперь есть дубль и для нового названия, то к нему еще раз индекс не добавляется, а увеличивается текущий индекс на 1. Этот пункт проверки повторяется до тех пока для нового названия не останется дублей.
  • Изменения порядка столбцов по их новым названиям не происходит. Например, были названия  "Тест4", "Тест" и "Тест". После изменения дублей названия последних 2х столбцов поменяются, но порядок останется тем же:
    Было: "Тест4", "Тест", "Тест"
    Стало: "Тест4", "Тест1", "Тест"
    Неверный вариант: "Тест", "Тест1", "Тест4".

Пример переименования столбцов

В браузере есть таблица:


При "Убрать дубли заголовка" = true, и "С заголовком" = True, действие вернет таблицу с 5 неповторяющимися заголовками. Переименование столбцов будет происходить так:

  • 1-ый столбец имеет дубль во 2м столбце. К названию нужно добавить 1 (будет "Тест1"), но если так сделать, то получится дубль с 3м столбцом. Поэтому увеличиваем индекс - 2 (будет "Тест2"), но и с таким индексом будет дубль - с 4 и 5 столбцами. Еще раз увеличиваем индекс - 3, для полученного названия "Тест3" дублей нет, оставляем его. Полученные столбцы:
  • 2-ой и 3-ий столбцы не имеют дублей, их пропускаем.
  • 4-ый столбец имеет дубль в 5м столбце. К названию нужно добавить 1 (будет "Тест21"), с таким индексом дублей нет в других столбцах. Полученные столбцы:
  • 5-ый столбец не имеет дублей. Проверка завершается.

Example of use

Task

Get the table in the variable "Table" located on the page on the Internet.

Solution

Use the "Open browser", "Get table" actions. 

Implementation

  1. Assemble a robot scheme with the actions: 
  2. Set the "Open browser" action parameter.

  3. Set the "Get table" action parameters. More about filling in the "Element" field in section Create Web-elements
  4. Start the robot by clicking "Start" in the top panel.

Result

The program robot completed successfully. We got the table. 



  • Нет меток