Handling
Web Tables in Selenium RC
1.
Read data from table in specified row and column
String
Str=selenium.getTable("locator.row.column");
2.
Read selected data from table
//
match for matching the required row
String
match,value;
//
First find the no of rows by counting the no of tr
int
rows=selenium.getXpathCount("//*[@id=' ']/body/tr").intValue();
//
Find no of columns by counting the number of td's under tr's
int
columns=selenium.getXpathCount("//*[@id='
']/body/tr/td").intValue();
for
(i=1;i<rows;i++)
{
match=selenium.getTable("locator."+i+".0").trim();
if
(match.equals("Matchingvalueinrow"))
{
for(j=0;j<columns;j++)
{
value=selenium.getTable("locator."+i+"."+j);
}
break;
}
}
Commands
used for tables :
- getXpathCount().intValue() --- To get the number of rows and columns.
=))
ReplyDelete
ReplyDeleteHello author,
I found your blog while searching for the updates in Selenium WebDriver,I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about selenium tutorials for beginners with reference of your blog.