Hi All,
user-extension.js:
Selenium.prototype.getTableRows = function(locator) {
/**
* Gets the number of rows in a table.
*
* @param locator element locator for table
* @return number of rows in the table, 0 if none
*/
return table.rows.length.toString();
};
<html>
<head>
</head>
<body>
<table id="tableWith3Rows">
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
</table>
<table id="tableWithNoRows">
</table>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TestTableRows</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestTableRows</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>./tests/html/test_table_rows.html</td>
<td></td>
</tr>
<tr>
<td>verifyTableRows</td>
<td>tableWith3Rows</td>
<td>3</td>
</tr>
<tr>
<td>verifyTableRows</td>
<td>tableWithNoRows</td>
<td>0</td>
</tr>
</tbody></table>
</body>
</html>
No comments:
Post a Comment