Skip to content

Commit 85c9b9b

Browse files
committed
Fixed table * should contains keywords
1 parent 5a531cb commit 85c9b9b

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

atest/acceptance/keywords/tables/footer_should_contain.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ Should Give Error Message When Content Not Found In Table Footer
1313
Run Keyword And Expect Error
1414
... Table 'withHeadAndFoot' footer did not contain text 'withHeadAndFoot_B2'.
1515
... Table Footer Should Contain withHeadAndFoot withHeadAndFoot_B2
16+
17+
Should Give Error Message When Content Not Found In Table Footer But Is Other Table
18+
Run Keyword And Expect Error
19+
... Table 'tableWithSingleHeader' footer did not contain text 'SimpleWithHeadAndFoot_CF1'.
20+
... Table Footer Should Contain tableWithSingleHeader SimpleWithHeadAndFoot_CF1

atest/acceptance/keywords/tables/header_should_contain.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ Should Give Error Message When Content Not Found In Table Header
1717
Run Keyword And Expect Error
1818
... Table 'withHeadAndFoot' header did not contain text 'withHeadAndFoot_B2'.
1919
... Table Header Should Contain withHeadAndFoot withHeadAndFoot_B2
20+
21+
Should Give Error Message When Content Not Found In Table Header But Is Other Table
22+
Run Keyword And Expect Error
23+
... Table 'tableWithSingleHeader' header did not contain text 'tableWithTwoHeaders_C1'.
24+
... Table Header Should Contain tableWithSingleHeader tableWithTwoHeaders_C1

atest/acceptance/keywords/tables/negative_indexes.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ Test negative index for XPath strategy in 'Table Cell Should Contain'
2727

2828
Test negative index for CSS strategy in 'Table Cell Should Contain'
2929
Table Cell Should Contain xpath=//*[@name='simpleTableName']
30-
... -1 -2 simpleTableName_B3
30+
... -1 -2 simpleTableName_B4

atest/acceptance/keywords/tables/table_should_contain.robot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ Should Give Error Message When Content Not Found In Table
3030
Run Keyword And Expect Error
3131
... Table 'simpleTable' did not contain text 'Not here'.
3232
... Table Should Contain simpleTable Not here
33+
34+
35+
Should Give Error Message When Content Not Found In Table But Is In Table In Below
36+
Run Keyword And Expect Error
37+
... Table 'simpleTable' did not contain text 'impleTableName_C4'.
38+
... Table Should Contain simpleTable impleTableName_C4

atest/resources/html/tables/tables.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ <h2>Simple Table by Name</h2>
4141
<td>simpleTableName_B3</td>
4242
<td>simpleTableName_C3</td>
4343
</tr>
44+
<tr>
45+
<td>simpleTableName_A4</td>
46+
<td>simpleTableName_B4</td>
47+
<td>simpleTableName_C4</td>
48+
</tr>
4449
</table>
4550

4651
<h2>Simple Table With Nested Table</h2>
@@ -166,6 +171,31 @@ <h2>Table with thead, tfoot and tbody sections</h2>
166171
</tbody>
167172
</table>
168173

174+
<h2>Another table with thead, tfoot and tbody sections</h2>
175+
<table id="SimpleWithHeadAndFoot" border="1" rules="groups">
176+
<thead>
177+
<tr>
178+
<th>SimpleWithHeadAndFoot_AH1</th>
179+
<th>SimpleWithHeadAndFoot_BH1</th>
180+
<th>SimpleWithHeadAndFoot_CH1</th>
181+
</tr>
182+
</thead>
183+
<tfoot>
184+
<tr>
185+
<td>SimpleWithHeadAndFoot_AF1</td>
186+
<td>SimpleWithHeadAndFoot_BF1</td>
187+
<td>SimpleWithHeadAndFoot_CF1</td>
188+
</tr>
189+
</tfoot>
190+
<tbody>
191+
<tr>
192+
<td>SimpleWithHeadAndFoot_A1</td>
193+
<td>SimpleWithHeadAndFoot_B1</td>
194+
<td>SimpleWithHeadAndFoot_C1</td>
195+
</tr>
196+
</tbody>
197+
</table>
198+
169199

170200
<h2>Table with mixed th and td</h2>
171201
<table id="mixed-th-td" border="1">

src/SeleniumLibrary/keywords/tableelement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,13 @@ def table_should_contain(self, locator, expected, loglevel='TRACE'):
194194
% (locator, expected))
195195

196196
def _find_by_content(self, table_locator, content):
197-
return self._find(table_locator, '//*', content)
197+
return self._find(table_locator, 'xpath:.//*', content)
198198

199199
def _find_by_header(self, table_locator, content):
200-
return self._find(table_locator, '//th', content)
200+
return self._find(table_locator, 'xpath:.//th', content)
201201

202202
def _find_by_footer(self, table_locator, content):
203-
return self._find(table_locator, '//tfoot//td', content)
203+
return self._find(table_locator, 'xpath:.//tfoot//td', content)
204204

205205
def _find_by_row(self, table_locator, row, content):
206206
position = self._index_to_position(row)

0 commit comments

Comments
 (0)