From d70fb3385b48b8f2b8a66a29ca321475c4535b3f Mon Sep 17 00:00:00 2001 From: vamsi Date: Sun, 8 Nov 2026 10:56:49 -0500 Subject: [PATCH 1/2] Fix Table Footer Should Contain for th cells --- .../tables/footer_should_contain.robot | 21 +++++++++++++++++++ atest/resources/html/tables/tables.html | 12 +++++++++++ src/SeleniumLibrary/keywords/tableelement.py | 6 +++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/atest/acceptance/keywords/tables/footer_should_contain.robot b/atest/acceptance/keywords/tables/footer_should_contain.robot index 72e0848b2..d4f4b8af0 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 \ No newline at end of file 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..6cf3eb670 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,7 @@ 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) From 0975d382608d7234cd22de938df6b0a7d56c487e Mon Sep 17 00:00:00 2001 From: vamsi Date: Sun, 8 Nov 2026 11:17:51 -0500 Subject: [PATCH 2/2] Clean up formatting for table footer fix --- atest/acceptance/keywords/tables/footer_should_contain.robot | 2 +- src/SeleniumLibrary/keywords/tableelement.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/tables/footer_should_contain.robot b/atest/acceptance/keywords/tables/footer_should_contain.robot index d4f4b8af0..6d3a3b37d 100644 --- a/atest/acceptance/keywords/tables/footer_should_contain.robot +++ b/atest/acceptance/keywords/tables/footer_should_contain.robot @@ -38,4 +38,4 @@ Should Not Find Body Header Text Outside Footer 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 \ No newline at end of file + ... Table Footer Should Contain withHeadAndFoot Total diff --git a/src/SeleniumLibrary/keywords/tableelement.py b/src/SeleniumLibrary/keywords/tableelement.py index 6cf3eb670..a4a02505e 100644 --- a/src/SeleniumLibrary/keywords/tableelement.py +++ b/src/SeleniumLibrary/keywords/tableelement.py @@ -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//*[self::td or self::th]", 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)