Quality Testing

Quality is delighting customers

How to get row count of a Webtable using Selenium RC?

How to get row count of a Webtable using Selenium RC? Can any one reply to my question.

 

R,

Namrata

Views: 2076

Reply to This

Replies to This Discussion

String[] options = selenium.getSelectOptions("xField");   

or 

String[] options = selenium.getSelectedLabels("xField");

    int count = options.length;       

  System.out.print(count);

Here is a table...

<table id="testRuns" border="0"  valign="top" align="left" cellpadding=0 cellspacing=0 class="TABLE_section_bar2">
<tr valign="top">
<td valign="top" class="TD_tool_bar1"><b>First Row, First Column</b></td>
<td valign="top" class="TD_tool_bar1">
<select id="some_dynamic_value"  multiple  size=2  class="select_small">
<option value="0" selected>---<br>
<option value="1505_2557">R10.4_Preprod<br>
</select>
</td>
</tr>
<tr valign="top">
<td valign="top" class="TD_tool_bar1"><b>Second Row, First Column</b></td>
<td valign="top" class="TD_tool_bar1"><b>Second Row, Second Column</b></td>
</tr>
</table>

What you want to do is get the row count, like so...

selenium.getXpathCount("//table[@id='testRuns']//tr");

this should return 2

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service