Read Data or HTML table Using WebDriver - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Tuesday 24 September 2013

Read Data or HTML table Using WebDriver

Code Snippet for how to Read Data or HTML table Using WebDriver



WebElement tab=driver.findElement(By.xpath("//table[@id='availabilityTable1']"));
List<WebElement> tableRows = tab.findElements(By.tagName("tr"));
 
                       {
for(WebElement cell:tableRows)
                         {
List<WebElement>data=cell.findElements(By.xpath("//td[5]"));//Reading 5th Column of the Table
for(WebElement d:data)
{
System.out.println(d.getText());
}
break;

2 comments:

  1. Neeraj Bakhtani,i want ur email id,could u pls give me so that i can solve all my issues.my emailid rahasrk@gmail.com

    Thank u
    Rani....

    ReplyDelete
    Replies
    1. Put your all queries here

      I will look into it and will share solutions with you.

      Thanks

      Delete