Buy From Flipkart

Wednesday, 11 December 2013

Handling table tags using Selenium Webdriver

While working with dynamic tables using Selenium Webdriver, following procedure could help you 


int tdSize = webdriver.findElements(By.xpath("//table[indexValue/xpathFromitsParentElenment]//td")).size();        for(int i=1;i<tdSize;i++)        {           if(webdriver.findElements(By.xpath("//table[indexValue/xpathFromitsParentElenment]//td[i]//div")).size()!=0)
           //if we have the div element in side td tag then the condition get passed
            {
              System.out.println("Data in <div> tag:"+webdriver.findElement(By.xpath("
//table[indexValue/xpathFromitsParentElenment]//td[i]//div")).getText());
          //for printing the content in the inner div tag
        }
           //if we have the div element in side td tag then the condition get passed
            {              System.out.println("Data in <div> tag:"+webdriver.findElement(By.xpath("//table[indexValue/xpathFromitsParentElenment]//td[i]//div")).getText());
          //for printing the content in the inner div tag
        }
          //for printing the content in the inner div tag        }}


Please do comment on any queries



How to install Maven on Windows

All possible ways for handling DragAndDrop using Selenium

All Possible ways for switching frames in Selenium

Automating tables tags using Selenium


Selenium Webdriver Integration with JBheave (BDD)