diff --git a/atest/acceptance/keywords/tables/footer_should_contain.robot b/atest/acceptance/keywords/tables/footer_should_contain.robot index 72e0848b2..6d3a3b37d 100644 --- a/atest/acceptance/keywords/tables/footer_should_contain.robot +++ b/atest/acceptance/keywords/tables/footer_should_contain.robot @@ -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 diff --git a/atest/resources/html/tables/tables.html b/atest/resources/html/tables/tables.html index 3e0c4cd41..ba1beb64c 100644 --- a/atest/resources/html/tables/tables.html +++ b/atest/resources/html/tables/tables.html @@ -245,6 +245,18 @@

Table With Merged Cells In a Column

+ + + + + + + + + + + +

Table With Formatting and Unicode

dummy Table
dummy Table
diff --git a/src/SeleniumLibrary/keywords/tableelement.py b/src/SeleniumLibrary/keywords/tableelement.py index a3100425f..a4a02505e 100644 --- a/src/SeleniumLibrary/keywords/tableelement.py +++ b/src/SeleniumLibrary/keywords/tableelement.py @@ -148,8 +148,8 @@ def table_footer_should_contain( ): """Verifies table footer contains text ``expected``. - Any ```` element inside ```` element is considered to - be part of the footer. + Any ```` or ```` element inside ```` 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. @@ -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)