Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions atest/acceptance/keywords/tables/footer_should_contain.robot
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,24 @@ Should Give Error Message When Content Not Found In Table Footer But Is Other Ta
Run Keyword And Expect Error
... Table 'tableWithSingleHeader' footer did not contain text 'SimpleWithHeadAndFoot_CF1'.
... Table Footer Should Contain tableWithSingleHeader SimpleWithHeadAndFoot_CF1

Should Find Text In Footer Header Cell
Table Footer Should Contain footer-with-header-cell Total

Should Find Text In Footer Data Cell
Table Footer Should Contain footer-with-header-cell 100 USD

Should Not Find Header Text Outside Footer
Run Keyword And Expect Error
... Table 'footer-with-header-cell' footer did not contain text 'Amount'.
... Table Footer Should Contain footer-with-header-cell Amount

Should Not Find Body Header Text Outside Footer
Run Keyword And Expect Error
... Table 'footer-with-header-cell' footer did not contain text 'Books'.
... Table Footer Should Contain footer-with-header-cell Books

Should Not Find Footer Header Text In Another Table
Run Keyword And Expect Error
... Table 'withHeadAndFoot' footer did not contain text 'Total'.
... Table Footer Should Contain withHeadAndFoot Total
12 changes: 12 additions & 0 deletions atest/resources/html/tables/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,18 @@ <h2>Table With Merged Cells In a Column</h2>
</tr>
</table>

<table id="footer-with-header-cell">
<thead>
<tr><th>Item</th><th>Amount</th></tr>
</thead>
<tbody>
<tr><th scope="row">Books</th><td>100</td></tr>
</tbody>
<tfoot>
<tr><th scope="row">Total</th><td>100 USD</td></tr>
</tfoot>
</table>

<h2 class="someClass">Table With Formatting and Unicode</h2>
<table><tr><td>dummy Table</td></tr></table>
<table><tr><td>dummy Table</td></tr></table>
Expand Down
8 changes: 5 additions & 3 deletions src/SeleniumLibrary/keywords/tableelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def table_footer_should_contain(
):
"""Verifies table footer contains text ``expected``.

Any ``<td>`` element inside ``<tfoot>`` element is considered to
be part of the footer.
Any ``<td>`` or ``<th>`` element inside ``<tfoot>`` element is
considered to be part of the footer.

The table is located using the ``locator`` argument. See the
`Locating elements` section for details about the locator syntax.
Expand Down Expand Up @@ -249,7 +249,9 @@ def _find_by_header(self, table_locator, content):
return self._find(table_locator, "xpath:.//th", content)

def _find_by_footer(self, table_locator, content):
return self._find(table_locator, "xpath:.//tfoot//td", content)
return self._find(
table_locator, "xpath:.//tfoot//*[self::td or self::th]", content
)

def _find_by_row(self, table_locator, row, content):
position = self._index_to_position(row)
Expand Down
Loading