There are many ways we can do this,
but in below example i am following "tr","td" approach.
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://money.rediff.com/");
WebElement element=driver.findElement(By.id("allpage_links"));
List<WebElement> rowCollection=element.findElements(By.xpath("//*[@id='allpage_links']/tbody/tr"));
System.out.println("Numer of rows in this table: "+rowCollection.size());
//Here i_RowNum and i_ColNum, i am using to indicate Row and Column numbers. It may or may not be required in real-time Test Cases.
int i_RowNum=1;
for(WebElement rowElement:rowCollection)
{
List<WebElement> colCollection=rowElement.findElements(By.xpath("td"));
int i_ColNum=1;
for(WebElement colElement:colCollection)
{
System.out.println("Row "+i_RowNum+" Column "+i_ColNum+" Data "+colElement.getText());
i_ColNum=i_ColNum+1;
}
i_RowNum=i_RowNum+1;
}
driver.close();
note - The above code is in Java but nevertheless LOGIc remains the same.
ReadOnlyCollection<IWebElement> tableRows = driver.FindElement(By.Id("tableIdValue")).FindElements(By.XPath("tbody/tr"));
return searchResultsRows.Where(searchResultsRow => !searchResultsRow.GetAttribute("class").Contains("grid_header")).Count;
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a24b5ca0-0e83-496d-86c3-e303b1856c11%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/34_sC1n3Lfs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALHJj-119HSo3_KCd0rL7iptndAzQvqLPOrx6b4KZ567xCEgSw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c829ade5-d72f-4c9d-8828-18d604ee45e9%40googlegroups.com.