Skip to content Skip to sidebar Skip to footer

Selenium WebDriver Can't Find Element By Link Text


Solution 2:

Use xpath and text()

driver.findElement(By.Xpath("//strong[contains(text(),'" + service +"')]"));

Solution 3:

This doesn't seem to have <a> </a> tags so selenium might not be able to detect it as a link.

You may try and use

driver.findElement(By.xpath("//*[@class='ng-binding']")).click();

if this is the only element in that page with this class .


Solution 4:

A CSS selector approach could definitely work here. Try:

driver.findElement(By.CssSelector("a.item")).Click();

This will not work if there are other anchors before this one of the class item. You can better specify the exact element if you do something like "#my_table > a.item" where my_table is the id of a table that the anchor is a child of.


Solution 5:

find_elements_by_xpath("//*[@class='class name']")

is a great solution


Post a Comment for "Selenium WebDriver Can't Find Element By Link Text"