Skip to content

Commit 0560186

Browse files
committed
Clean up table keyword docs. robotframework#925
1 parent 19ae783 commit 0560186

File tree

1 file changed

+61
-61
lines changed

1 file changed

+61
-61
lines changed

src/SeleniumLibrary/keywords/tableelement.py

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@ class TableElementKeywords(LibraryComponent):
2121

2222
@keyword
2323
def get_table_cell(self, locator, row, column, loglevel='INFO'):
24-
"""Returns the content from a table cell.
24+
"""Returns contents of table cell.
2525
26-
Row and column number start from 1. Header and footer rows are
27-
included in the count. A negative row or column number can be used
28-
to get rows counting from the end (end: -1). Cell content from header
29-
or footer rows can be obtained with this keyword. To understand how
30-
tables are identified, please take a look at the `introduction`.
26+
The table is located using the ``locator`` argument and its cell
27+
found using ``row`` and ``column``. See the `Locating elements`
28+
section for details about the locator syntax.
3129
32-
See `Page Should Contain` for explanation about `loglevel` argument.
30+
Both row and column indexes start from 1, and header and footer
31+
rows are included in the count. It is possible to refer to rows
32+
and columns from the end by using negative indexes so that -1
33+
is the last row/column, -2 is the second last, and so on.
34+
35+
All ``<th>`` and ``<td>`` elements anywhere in the table are
36+
considered to be cells.
37+
38+
See `Page Should Contain` for explanation about the ``loglevel``
39+
argument.
3340
"""
3441
row = int(row)
3542
column = int(column)
@@ -70,19 +77,10 @@ def _get_rows(self, locator, count):
7077

7178
@keyword
7279
def table_cell_should_contain(self, locator, row, column, expected, loglevel='INFO'):
73-
"""Verifies that a certain cell in a table contains `expected`.
74-
75-
Row and column number start from 1. This keyword passes if the
76-
specified cell contains the given content. If you want to test
77-
that the cell content matches exactly, or that it e.g. starts
78-
with some text, use `Get Table Cell` keyword in combination
79-
with built-in keywords such as `Should Be Equal` or `Should
80-
Start With`.
81-
82-
To understand how tables are identified, please take a look at
83-
the `introduction`.
80+
"""Verifies table cell contains text ``expected``.
8481
85-
See `Page Should Contain` for explanation about `loglevel` argument.
82+
See `Get Table Cell` that this keyword uses internally for
83+
explanation about accepted arguments.
8684
"""
8785
content = self.get_table_cell(locator, row, column, loglevel)
8886
if expected not in content:
@@ -95,24 +93,21 @@ def table_cell_should_contain(self, locator, row, column, expected, loglevel='IN
9593

9694
@keyword
9795
def table_column_should_contain(self, locator, column, expected, loglevel='INFO'):
98-
"""Verifies that a specific column contains `expected`.
96+
"""Verifies table column contains text ``expected``.
9997
100-
The first leftmost column is column number 1. A negative column
101-
number can be used to get column counting from the end of the row (end: -1).
102-
If the table contains cells that span multiple columns, those merged cells
103-
count as a single column. For example both tests below work,
104-
if in one row columns A and B are merged with colspan="2", and
105-
the logical third column contains "C".
98+
The table is located using the ``locator`` argument and its column
99+
found using ``column``. See the `Locating elements` section for
100+
details about the locator syntax.
106101
107-
Example:
108-
| Table Column Should Contain | tableId | 3 | C |
109-
| Table Column Should Contain | tableId | 2 | C |
102+
Column indexes start from 1. It is possible to refer to columns
103+
from the end by using negative indexes so that -1 is the last column,
104+
-2 is the second last, and so on.
110105
111-
To understand how tables are identified, please take a look at
112-
the `introduction`.
106+
If a table contains cells that span multiple columns, those merged
107+
cells count as a single column.
113108
114-
See `Page Should Contain Element` for explanation about
115-
`loglevel` argument.
109+
See `Page Should Contain Element` for explanation about the
110+
``loglevel`` argument.
116111
"""
117112
element = self.table_element_finder.find_by_column(locator, column, expected)
118113
if element is None:
@@ -122,14 +117,16 @@ def table_column_should_contain(self, locator, column, expected, loglevel='INFO'
122117

123118
@keyword
124119
def table_footer_should_contain(self, locator, expected, loglevel='INFO'):
125-
"""Verifies that the table footer contains `expected`.
120+
"""Verifies table footer contains text ``expected``.
126121
127-
With table footer can be described as any <td>-element that is
128-
child of a <tfoot>-element. To understand how tables are
129-
identified, please take a look at the `introduction`.
122+
Any ``<td>`` element inside ``<tfoot>`` element is considered to
123+
be part of the footer.
130124
131-
See `Page Should Contain Element` for explanation about
132-
`loglevel` argument.
125+
The table is located using the ``locator`` argument. See the
126+
`Locating elements` section for details about the locator syntax.
127+
128+
See `Page Should Contain Element` for explanation about the
129+
``loglevel`` argument.
133130
"""
134131
element = self.table_element_finder.find_by_footer(locator, expected)
135132
if element is None:
@@ -139,13 +136,16 @@ def table_footer_should_contain(self, locator, expected, loglevel='INFO'):
139136

140137
@keyword
141138
def table_header_should_contain(self, locator, expected, loglevel='INFO'):
142-
"""Verifies that the table header, i.e. any <th>...</th> element, contains `expected`.
139+
"""Verifies table header contains text ``expected``.
140+
141+
Any ``<th>`` element anywhere in the table is considered to be
142+
part of the header.
143143
144-
To understand how tables are identified, please take a look at
145-
the `introduction`.
144+
The table is located using the ``locator`` argument. See the
145+
`Locating elements` section for details about the locator syntax.
146146
147-
See `Page Should Contain Element` for explanation about
148-
`loglevel` argument.
147+
See `Page Should Contain Element` for explanation about the
148+
``loglevel`` argument.
149149
"""
150150
element = self.table_element_finder.find_by_header(locator, expected)
151151
if element is None:
@@ -155,21 +155,21 @@ def table_header_should_contain(self, locator, expected, loglevel='INFO'):
155155

156156
@keyword
157157
def table_row_should_contain(self, locator, row, expected, loglevel='INFO'):
158-
"""Verifies that a specific table row contains `expected`.
158+
"""Verifies that table row contains text ``expected``.
159+
160+
The table is located using the ``locator`` argument and its column
161+
found using ``column``. See the `Locating elements` section for
162+
details about the locator syntax.
159163
160-
The uppermost row is row number 1. A negative column
161-
number can be used to get column counting from the end of the row
162-
(end: -1). For tables that are structured with thead, tbody and tfoot,
163-
only the tbody section is searched. Please use `Table Header Should Contain`
164-
or `Table Footer Should Contain` for tests against the header or
165-
footer content.
164+
Row indexes start from 1. It is possible to refer to rows
165+
from the end by using negative indexes so that -1 is the last row,
166+
-2 is the second last, and so on.
166167
167-
If the table contains cells that span multiple rows, a match
168-
only occurs for the uppermost row of those merged cells. To
169-
understand how tables are identified, please take a look at
170-
the `introduction`.
168+
If a table contains cells that span multiple rows, a match
169+
only occurs for the uppermost row of those merged cells.
171170
172-
See `Page Should Contain Element` for explanation about `loglevel` argument.
171+
See `Page Should Contain Element` for explanation about the
172+
``loglevel`` argument.
173173
"""
174174
element = self.table_element_finder.find_by_row(locator, row, expected)
175175
if element is None:
@@ -179,13 +179,13 @@ def table_row_should_contain(self, locator, row, expected, loglevel='INFO'):
179179

180180
@keyword
181181
def table_should_contain(self, locator, expected, loglevel='INFO'):
182-
"""Verifies that `expected` can be found somewhere in the table.
182+
"""Verifies table contains text ``expected``.
183183
184-
To understand how tables are identified, please take a look at
185-
the `introduction`.
184+
The table is located using the ``locator`` argument. See the
185+
`Locating elements` section for details about the locator syntax.
186186
187-
See `Page Should Contain Element` for explanation about
188-
`loglevel` argument.
187+
See `Page Should Contain Element` for explanation about the
188+
``loglevel`` argument.
189189
"""
190190
element = self.table_element_finder.find_by_content(locator, expected)
191191
if element is None:

0 commit comments

Comments
 (0)