Parsing HTML table data with xpath and selenium in java

前端 未结 4 1108
清歌不尽
清歌不尽 2020-12-10 09:49

I want to take the data and organize it without the tags. It looks something like this

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 10:36

    As another option you could grab all the cells of the table into one array and access them that way. EG.

    ReadOnlyCollection Cells = driver.FindElements(By.XPath("//table[@class='SpecTable']//tr//td"));
    

    This will get you all the cells in that table as an array which you can then use to access the text iteratively.

    string forOutput = Cells[i].Text;
    

提交回复
热议问题