Selenium Webdriver - Fetching Table Data

后端 未结 7 1979
执笔经年
执笔经年 2021-02-04 08:03

I want to fetch data from tables in UI. I know about looping through rows and columns using \"tr\" and \"td\". But the one the table I have is something like this:



        
7条回答
  •  遥遥无期
    2021-02-04 08:43

    You could look for all children of tr element without differentiating between td and th. So instead of

    List cells = row.findElements(By.tagName("td"));
    

    I would use

    List cells = row.findElements(By.xpath("./*"));
    

提交回复
热议问题