Working with tables
The commands
Currently slimdog supports two methods to test tables. The first method:
select_table | id of the table
is used to select a table by its id.
In order to check the content of a tablecell use:
check_tablecell | (xpos,ypos) = required text
The xpos and ypos are both the zero based position of the cell within the table.
Example
The HTML source for this example looks like this:
<table border="1" id="MyTestTable">
<tr>
<td>cell11</td><td>cell12</td><td>cell13</td>
</tr>
<tr>
<td>cell21</td><td>cell22</td><td>cell23</td>
</tr>
<tr>
<td>cell31</td><td>cell32</td><td>cell33</td>
</tr>
</table>
The id of the table will be used to select the table.
Here is the testscipt:
get_html | http://localhost:8181/table.html
check_title | Table test
select_table | MyTestTable
check_tablecell | (0,0) = cell11
check_tablecell | ( 1 ,1 ) = cell22
Note the x and y position of a tablecell is always zero based. If one the positions are out of the table dimension then the test will fail.