How to get text from each cell of an HTML table?

前端 未结 6 1840
渐次进展
渐次进展 2020-12-13 03:15

In Selenium 2.0, I have no idea how to traverse through a HTML table in a webpage. In selenium2.0 javadoc, I found two classes \"TableFinder\" and \"TableCellFinder\", but

6条回答
  •  囚心锁ツ
    2020-12-13 03:35

    I have not used Selenium 2. Selenium 1.x has selenium.getTable("tablename".columnNumber.rowNumber) to reach the required cell. May be you can use webdriverbackedselenium and do this.

    And you can get the total rows and columns by using

    int numOfRows = selenium.getXpathCount("//table[@id='tableid']//tr")

    int numOfCols=selenium.getXpathCount("//table[@id='tableid']//tr//td")
    

提交回复
热议问题