Clicking on a hypertext link using XPath

后端 未结 3 371
予麋鹿
予麋鹿 2021-01-21 20:16

Apologies if this is a dumb question - I\'m new to Selenium.

I have a web page I\'m testing that has a few hypertext links in a table. The HTML looks like this:

3条回答
  •  天涯浪人
    2021-01-21 20:54

    You can gather all the links together by using findElements and then iterate through the array.

    Example - List inputs = driver.findElements(By.xpath("//input"));

    and in your case

    List links = driver.findElements(By.linkText("Show"));

    and then iterate through links and click on each one of them

提交回复
热议问题