Using selenium, I am trying to click on an element <td>that appears immediately before an element <td>that has a linkText from "Main". I am trying to click the selected item in this image:

And the element <td>that I want to click, and the one that after it is inside the same element <tr>shown in the image as having id=5.
This element corresponds to the integer line highlighted below. Notice how its linkText is "green", like the element below it. Therefore, I cannot use the xpath / css selector for the element <td>I want to click.

I am trying to click the highlighted green. This is why I am trying to click an element <td> in front of an element with "Main" as its linkText.
I have this code, but I don’t know how to get the element before the element that matches this code: WebElement templateFound = driver.findElement(By.linkText("Main"));
All thanks, thanks
source
share