HTML code looks like this:
<td id="id26a" class="doclisting-name link" style="width: 319px; min-width: 319px;">
<span id="id26b" title="Document">
<span class="ie-fallback-marker">
words
</span></span></td>
I cannot search for Element ID, as it changes all the time. I cannot search for the element's class, as there are multiples which could change locations.
I want to be able to click on "WORDS" in between the SPAN tags. Is this at all possible?
This is what I used so far, but neither seems to work:
//string document is words.
public void testscenario123(String document) throws Throwable {
Thread.sleep(3000);
driver.findElement(By.linkText(document)).click();
}
or
//string document is words.
public void testscenario124(String document) throws Throwable {
Thread.sleep(3000);
driver.findElement(By.xpath("//*[contains(@span,'"+document+"')]")).click();
}