I would like to find an element using a differect cssSelector / tag / ClassName amd them get it\'s xpath value ( to be more specific, I have a website where when a day changes,
You can find the index by locating all the <td>
elements in the first row and check wich one has the index
List<WebElement> columns = driver.findElements(By.xpath("//tr[td[@class='active']]/td")); # just an example, can be any other locator
int index = 0;
for (int i = 0 ; i < columns.getSize() ; i++) {
String attribute = columns.get(i).getAttribute("class")
if (attribute != null && attribute.equals("active")) {
index = i + 1;
}
}