Skip to main content
Version: 7.5.5

Tables, Rows, Columns and Cells

Tables

Tables are widely used in Pega as a separate type of elements or as a component of other controls (autocompletion fields, multiselects, etc.). It is possible to find table elements by following attributes:

NameParameter(s)TypeDescription
tabledataTestIdstringSearches for a div element that contains a table by value of a Pega data-test-id attribute, same as tableByDataTestId
tableByTestIddataTestIdstringSearches for a div element that contains a table by value of a Pega data-test-id attribute, same as table
tableByTitleplPropstringSearches for a table element by value of a Pega pl_prop attribute (usually equal to a table title)
tableByattributeNamestringSearches for a table (or any other specified)* element by an attribute name and value
attributeValuestring
elementTypestring*
  • It is possible to pass ab elementType parameter per each table function. For 3 of them there is a default value (div for table and tableByDataTestId; table for tableByTitle), for 1 element type is not specified and is a mandatory parameter (tableBy);

Tables methods are rarely used as a separate step. More often table() is a starting point in a chain that includes a particular type of Pega element inside a particular table cell, e.g.:

await pega.tableByTitle(`.Books`)
.row(1)
.cell(`Author`)
.shouldHaveReadonlyText(`William Shakespeare`);

However, the table control still includes some specific actions and assertions. Information about rows, columns, cells, headers and possible actions you will find just after main table section.

Main action functions

NameParameter(s)TypeDescription
addRowAdds a row to the given table (default selector is //a[contains(normalize-space(.), 'Add Item')])
deleteRowDeletes a row from the given table (default selector is //a[contains(normalize-space(.), 'Delete')])
rowElementsReturns selector for all row elements on the given table

Assertions

Specific assertions

NameParameter(s)TypeDescription
shouldContainNumberOfRowsrowsNumbernumberChecks if number of rows in the given table is equal to the expected one (same as assertNumberOfRows)
options?{ timeout?: number, interval?: number, retries?: number }
shouldContainAtLeastrowsNumbernumberChecks if number of rows in the given table is equal or larger than the expected one (same as assertNumberOfRowsIsAtLeast)
options?{ timeout?: number, interval?: number, retries?: number }
shouldContainAtMostrowsNumbernumberChecks if number of rows in the given table is equal or lower than the one (same as shouldContainAtMost)
options?{ timeout?: number, interval?: number, retries?: number }
assertNumberOfRowsrowsNumbernumberChecks if number of rows in the given table is equal to the expected one (same as shouldContainNumberOfRows)
options?{ timeout?: number, interval?: number, retries?: number }
assertNumberOfRowsIsAtLeastrowsNumbernumberChecks if number of rows in the given table is equal or larger than the expected one (same as shouldContainAtLeast)
options?{ timeout?: number, interval?: number, retries?: number }
assertNumberOfRowsIsAtMostrowsNumbernumberChecks if number of rows in the given table is equal or lower than the one (same as shouldContainAtMost)
options?{ timeout?: number, interval?: number, retries?: number }

Common assertions

NameParameter(s)TypeDescription
shouldBeVisibleoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists and is visible
shouldExistoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists
shouldNotBeVisibleoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists but is not visible
shouldNotExistoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element does not exist

Wait for functions

Simple wait for visibility functions

NameParameter(s)TypeDescription
waitUntilVisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be visible
waitUntilInvisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be invisible
waitUntilElementExistsoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to exist
waitUntilElementNotExistoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element not to exist

Complex wait for visibility functions

Allow filtering of available elements by index, text, attribute:

NameParameter(s)TypeDescription
waitUntilVisibilityByTexttextstringFilters collection of elements by text and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByAttributeattributeNamestringFilters collection of elements by attribute and waits for the element to be visible
attributeValuestring
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByIndexindexnumberFilters collection of elements by index and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilInvisibilityByIndexindexnumberFilters collection of elements by index and waits for the element not to be visible
options?{ timeout?: number, interval?: number, retries?: number }

Actionability check

ActionabilityCheckTypes == attached | stable | visible | enabled | editable

NameParameter(s)TypeDescription
waitForSelectActionabilityCheckcheck types[]Waits for the element to pass all the selected actionability check types
isFilterByVisibilityboolean (true by default)

e.g.

await pega.tableByTitle(`.Books`)
.waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);

IsVisible and IsExists functions

NameParameter(s)TypeDescription
isVisibleoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists and is visible
isExistsoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists

Rows

It is possible to navigate in the table via rows => cells or columns => cells. You can`t combine rows and columns in one chain.

Row elements in Pega-Model library can be found by row index.

info

For the custom row selector info check the corresponding section of this page.

A few specific actions and assertions are available for row elements, but mostly they are used to navigate to the cell element as a next step:

Main action functions

NameParameter(s)TypeDescription
hoveroptions?{ timeout?: number, interval?: number, retries?: number }Hovers over the element. A hovered element is ready to be activated with a mouse or any mouse-emulating technology
clickoptions?{ timeout?: number, interval?: number, retries?: number }Clicks in the field
hoverAndClickHovers over the element then clicks

Assertions

NameParameter(s)TypeDescription
shouldBeVisibleoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists and is visible
shouldNotBeVisibleoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists but is not visible

Column

Columns can be found by index (number) or title (string). Depending on the passed parameter type (string or number), filters will be applied accordingly.

info

For the custom column selector info check the corresponding section of this page.

A few assertions are available for columns elements, but mostly they are used to navigate to the cell element as a next step:

Assertions

NameParameter(s)TypeDescription
shouldHaveSizecountnumberChecks if the number of columns is equal to the expected one
options?{ timeout?: number, interval?: number, retries?: number }
shouldHaveTextstextsstring[]Checks if titles of columns contain all the elements from the values list (elements order is considered too)
options?{ timeout?: number, interval?: number, retries?: number }
shouldHaveExactTextstextsstring[]Checks if titles of columns are equal to the elements from the values list (elements order is considered too)
options?{ timeout?: number, interval?: number, retries?: number }
shouldHaveExactTextsInAnyOrdertextsstring[]Checks if titles of columns are equal to the elements from the values list (elements order is not considered)
options?{ timeout?: number, interval?: number, retries?: number }

Cell

important

The very first cell in a row in Pega tables is not visible often, that`s why cell index should start from '1', not '0') or columns title. Depending on the passed parameter type (string or number), filters will be applied accordingly.

Usually, cell elements could be found by chaining table/row(or column)/cell, e.g.:

 await pega.tableByTitle(`.Books`)
.row(1)
.cell(`selected`)
.checkbox().shouldBeChecked();

or

await pega.tableByTitle(`.Books`)
.column(`Author`)
.cell(1)
.shouldHaveReadonlyTextByDataTestId(`William Shakespeare`,`2016072109335505834280`,`span` );

In addition to that, it is also possible to navigate directly from a table element to a cell element (by passing coordinates object):

    await pega.tableByTitle(`.Books`).cell({rowIndex: 1, columnIndex: 2})
.dropdownMenuShouldHaveValue('Available');

A cell element is usually not the final goal of the element search, the user is mostly interested in the element inside it. It might be text input, readonly text, checkbox, etc.

Main action functions

NameParameter(s)TypeDescription
focusoptions?{ timeout?: number, interval?: number, retries?: number }Focuses the element. A focused element is ready to be activated with a keyboard or any keyboard-emulating technology
hoveroptions?options? { timeout?: number, interval?: number, retries?: number }Hovers over the element. A hovered element is ready to be activated with a mouse or any mouse-emulating technology
pressTabSimulates "press Tab key" action
clickoptions?{ timeout?: number, interval?: number, retries?: number }Clicks in the field
clickTheLinkoptions?{ timeout?: number, interval?: number, retries?: number }Clicks an a element inside the cell element
setvaluestring / numberSets the value to an input element inside the cell element
options?{ timeout?: number, interval?: number, retries?: number }
pastevaluestring / numberPastes the value to an input element inside the cell element
options?{ timeout?: number, interval?: number, retries?: number }
selectValueFromDropdownMenuvaluestring / numberSelects a value of a dropdown inside the cell element
options?{ timeout?: number, interval?: number, retries?: number }

Assertions

NameParameter(s)TypeDescription
shouldHaveTexttextstring / numberChecks if the input element inside the cell has inner text that contains a given string
options?{ timeout?: number, interval?: number, retries?: number }
shouldNotHaveTexttextstring / numberChecks if the input element inside the cell has inner text that does not contain a given string
options?{ timeout?: number, interval?: number, retries?: number }
shouldHaveReadonlyTexttextstring / numberChecks if the span element inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type)
innerTypestring(span by default)
options?{ timeout?: number, interval?: number, retries?: number }
shouldHaveReadonlyTextByDataTestIdtextstring / numberChecks if the span element with a given data-test-id inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type)
data-test-idstring
innerTypestring(span by default)
options?{ timeout?: number, interval?: number, retries?: number }
shouldNotHaveReadonlyTexttextstring / numberChecks if the span element inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type)
innerTypestring(span by default)
options?{ timeout?: number, interval?: number, retries?: number }
shouldNotHaveReadonlyTextByDataTestIdtextstring / number,Checks if the span element with a given data-test-id inside the cell has inner text that contains a given string (a span element type can be replaced by any other element type)
data-test-idstring
innerTypestring(span by default)
options?{ timeout?: number, interval?: number, retries?: number }
shouldHaveValuevaluestring / numberChecks if the input element inside the cell has a value that contains a given string
options?{ timeout?: number, interval?: number, retries?: number }
shouldNotHaveValuevaluestring / numberChecks if the input element inside the cell has a value that doe not contain a given string
options?{ timeout?: number, interval?: number, retries?: number }
shouldNotBeBlankinnerTypestring(span by default)Checks if the span element inside the cell has inner text that is not equal to an empty string "" (a span element type can be replaced by any other element type)
options?{ timeout?: number, interval?: number, retries?: number }
shouldBeBlankinnerTypestring(span by default)Checks if the span element inside the cell has inner text that is equal to an empty string "" (a span element type can be replaced by any other element type)
options?{ timeout?: number, interval?: number, retries?: number }
shouldContainElementWithAttributesattributes{}Checks if the cell element contains an element with given attributes
options?{ timeout?: number, interval?: number, retries?: number }
shouldNotContainElementWithAttributesattributes{}Checks if the cell element does not contain an element with given attributes
options?{ timeout?: number, interval?: number, retries?: number }
dropdownMenuShouldHaveValuevaluestring / numberChecks if the option element inside the cell element has an attribute selected
options?{ timeout?: number, interval?: number, retries?: number }

Functions that return selectors or new controls instances

This group of functions return selectors of some specific elements inside the cell or a new instance of the Pega Model controls. Selectors can be reused as xpathes in specific or custom controls, controls might be used like usual ones with all the methods available for simple controls.

NameParameter(s)TypeDescription
iconReturns an i element inside the cell element
buttonReturns a new ButtonsActions instance
labelReturns a label element inside the cell element
switcherReturns a for element inside the cell element
checkboxReturns a new Checkbox (Table Checkbox) instance
linkReturns an a element inside the cell element

Wait for functions

Simple wait for visibility functions

NameParameter(s)TypeDescription
waitUntilVisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be visible
waitUntilInvisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be invisible
waitUntilElementExistsoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to exist
waitUntilElementNotExistoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element not to exist

Complex wait for visibility functions

Allow filtering of available elements by index, text, attribute:

NameParameter(s)TypeDescription
waitUntilVisibilityByTexttextstringFilters collection of elements by text and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByAttributeattributeNamestringFilters collection of elements by attribute and waits for the element to be visible
attributeValuestring
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByIndexindexnumberFilters collection of elements by index and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilInvisibilityByIndexindexnumberFilters collection of elements by index and waits for the element not to be visible
options?{ timeout?: number, interval?: number, retries?: number }

Wait for a collection size functions

NameParameter(s)TypeDescription
waitUntilCollectionOfElementsSizeIsGreaterOrEqualexpectedSizenumberWaits until collection of elements have specific size (or there are more)
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilCollectionOfElementsSizeIsLessThanexpectedSizenumberWaits until collection of elements have fewer elements than specified
options?{ timeout?: number, interval?: number, retries?: number }

Actionability check

ActionabilityCheckTypes == attached | stable | visible | enabled | editable

NameParameter(s)TypeDescription
waitForSelectActionabilityCheckcheck types[]Waits for the element to pass all the selected actionability check types
isFilterByVisibilityboolean (true by default)

e.g.

await pega.table('Gadgets').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);

A header element can be defined by index (number) or title (string). Depending on the passed parameter type (string or number), filters will be applied accordingly. e.g.:

 await pega.tableByTitle(`.Books`).header(`Author`).shouldBeVisible();

or

await pega.tableByTitle(`.Books`).header(2).shouldHaveText(`Year`);
info

For the custom header selector info check the corresponding section of this page.

Main action functions

NameParameter(s)TypeDescription
focusoptions?{ timeout?: number, interval?: number, retries?: number }Focuses the element. A focused element is ready to be activated with a keyboard or any keyboard-emulating technology
hoveroptions?{ timeout?: number, interval?: number, retries?: number }Hovers over the element. A hovered element is ready to be activated with a mouse or any mouse-emulating technology
clickoptions?{ timeout?: number, interval?: number, retries?: number }Clicks in the field
clickTheLinkoptions?{ timeout?: number, interval?: number, retries?: number }Clicks the //ancestor::th//a element inside the cell element
filteroptions?{ timeout?: number, interval?: number, retries?: number }Opens a filter menu of the header (if any)
sortoptions?{ timeout?: number, interval?: number, retries?: number }Sorts the value of the column

Assertions

NameParameter(s)TypeDescription
shouldBeVisibleoptions?{ timeout?: number, interval?: number, retries?: number }Checks if the element exists and visible
shouldNotBeVisibleoptions?{ timeout?: number, interval?: number, retries?: number }Checks if the element exists but is not visible
shouldHaveTextvaluestringChecks if the element's inner text contains a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }
shouldNotHaveTextvaluestringChecks if the element's inner text does not contain a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }
shouldHaveExactTextvaluestringChecks if the element's inner text is equal to a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }
shouldNotHaveExactTextvaluestringChecks if the element's inner text is not equal to a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }

Wait for functions

Simple wait for visibility functions

NameParameter(s)TypeDescription
waitUntilVisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be visible
waitUntilInvisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be invisible
waitUntilElementExistsoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to exist
waitUntilElementNotExistoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element not to exist

Complex wait for visibility functions

Allow filtering of available elements by index, text, attribute:

NameParameter(s)TypeDescription
waitUntilVisibilityByTexttextstringFilters collection of elements by text and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByAttributeattributeNamestringFilters collection of elements by attribute and waits for the element to be visible
attributeValuestring
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByIndexindexnumberFilters collection of elements by index and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilInvisibilityByIndexindexnumberFilters collection of elements by index and waits for the element not to be visible
options?{ timeout?: number, interval?: number, retries?: number }

Wait for a collection size functions

NameParameter(s)TypeDescription
waitUntilCollectionOfElementsSizeIsGreaterOrEqualexpectedSizenumberWaits until collection of elements have specific size (or there are more)
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilCollectionOfElementsSizeIsLessThanexpectedSizenumberWaits until collection of elements have fewer elements than specified
options?{ timeout?: number, interval?: number, retries?: number }

Actionability check

ActionabilityCheckTypes == attached | stable | visible | enabled | editable

NameParameter(s)TypeDescription
waitForSelectActionabilityCheckcheck types[]Waits for the element to pass all the selected actionability check types
isFilterByVisibilityboolean (true by default)

e.g.

await pega.table('Gadgets').header(1).waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);

Custom row, column and header selectors

Pega custom tables might require non-standard selectors to find a row, header or column element. Then a user needs to find an xpath selector of a corresponding element and to use it in the function (index is an optional parameter):

await pega.tableByTitle(`.Books`).customHeaderByIndex(`//th[@role="columnheader"]//div[@class="cellIn " and text()="Text"]`, 0).shouldHaveExactText(`Year`);

await pega.table(``).customRowByIndex(`//tr[contains(@class, "cellCont") and @data-test-id="2022072109335505834280"]`).cell(4).dropdownMenuShouldHaveValue('Optional');