HTML table is a common composite control you will find on web applications for listing of data. accelQ supports comprehensive functionality related to automated test logic development on tables. You can dynamically parse tables, locate required rows & columns and also get a handle on elements that are part of table content.
This article describes most common commands useful when working with HTML tables.
Locating HTML table on View
An HTML table control is identified as Web Table in accelQ view analyzer. When you hover in the table area, View canvas clearly displays the boundary of the table and the immediate cell inside the table. Row number and column number for the current cell number is displayed in the tooltip. These row/column numbers are useful while building logic with various commands.
Note: In all Web Table commands, row numbering and column/cell numbering starts from 1. First row/column is indicated with 1.
Note: Table header is not distinguished from a table row. A table header, if it exists is considered as row #1, and hence the first data row will be considered row #2.
Finding required row, dynamically
As part of your testing, it is a common requirement to find the row in a table matching given criterion. ACCELQ supports this requirement thru a comprehensive command.
Finding rows / columns
Get Cell Number Containing Text (given row)
Returns the cell index in the given row of an HTML table containing required text. Returns -1 if the row does not have any cell that contains required text.
Get Table Row Containing Text
Returns the row index of an HTML table containing given text.
Get Table Cell Count (given row)
Returns the count of number of cells in the given row of an HTML table.
Get Table Cell Text
Returns text from the given cell in the HTML table.
Get Table Row Count
Returns the row count from the given HTML table.
Verify DB Query With Web Table
Compares information from a database query against the content of a table. Extremely helpful when you have grid of information displayed in front-end based on a query on DB. You can make direct verification of result from DB with front-end.
Verify Element Exists In Table Cell
Verifies whether the given element exists in the table cell. This is verification command and it fails the test execution if the verification fails.
Verify Number of Cells in Table Row
Verifies the number of cells in a given row of an HTML table against an expected value.
Verify Number of Table Rows
Verifies the number of rows in an HTML table against an expected value.
Verify Table Cell Text
Verifies the text in a HTML table cell against an expected value.
Interacting with table and elements inside a cell
Click element in a table cell
Click a given template (repeat) element in a table cell. Make sure to pass the element as a generic, repeatable element.
Example 1: Following snippet clicks second cell in of first row in savings table.
Example 2: Following snippet clicks, first HTML link (anchor element) in second cell of first row in savings table.
Example 3: Following snippet clicks on button element in first cell of second row in savings table.
Click Table Row
Clicks given row element in the HTML table. Row numbering starts from 1.
Enter text in an element, in table cell
Enters text in given template (repeat) element in a table cell. Make sure to pass the element as a generic, repeatable element.
Enter Text In Table Cell
Enters text in the given cell number of an HTML table.
Mouse Over Cell
Moves the mouse over to the given element
Select Item In Table Cell
Selects given dropdown item in the cell element in a HTML table.