It is simple. Try the below code:
1. This function locates the table in a html page.
2. Finds no. of rows in a table.
3. Reads each row data & appends into single variable.
4. Returns the variable.
Selenium.prototype.getSaraTableAppend = function(tableName) {
try
{
var table = this.browserbot.findElement(tableName);
var rows = table.rows.length;
var apptxt = 0;
for (var i = 2; i < rows ; i++)
{
var celltxt = getText(table.rows[i].cells[0]);
apptxt = apptxt + celltxt;
}
return apptxt;
}
catch (e)
{
throw new SeleniumError("Threw an exception!" + e.message);
}
};
|
Then call this function in Selenium IDE as,
<tr>
<td>storeSaraTableAppend</td>
<td>css=table</td>
<td>Result</td>
</tr>
Ex:
Table is as below :
123
456
789
Abc
efg
Results contains data as: 0123456789Abcefg
No comments:
Post a Comment