How to find specific lines in a table using Selenium?

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

Here is an example code:

So this table being in prod

6条回答
  •  北海茫月
    2021-01-02 10:24

    if you want to access table cell

    WebElement thirdCell = driver.findElement(By.Xpath("//table/tbody/tr[2]/td[1]")); 
    

    If you want to access nested table cell -

    WebElement thirdCell = driver.findElement(By.Xpath("//table/tbody/tr[2]/td[2]"+//table/tbody/tr[1]/td[2]));
    

    For more details visit this Tutorial

提交回复
热议问题