How to find specific lines in a table using Selenium?

前端 未结 6 504
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 09:52

Here is an example code:

So this table being in prod

6条回答
  •  温柔的废话
    2021-01-02 10:25

    you can try following

    int index = 0;
    WebElement baseTable = driver.findElement(By.className("table gradient myPage"));
    List tableRows = baseTable.findElements(By.tagName("tr"));
    tableRows.get(index).getText();
    

    You can also iterate over tablerows to perform any function you want.

提交回复
热议问题