I am trying to click a datapoint on a chart. The code that I have is:
public void select(int datapoint) {
getWrappedElement()
.findElement(By.cssSelector(".wk-chart-area"))
.findElements(By.xpath("*[local-name() = 'g']")).get(0)
.findElements(By.xpath("*[local-name() = 'rect']"))
.get(datapoint)
.click();
}
This code was working just fine with older version firefox, however the newer version of firefox and chrome do not work and the error is:
org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (644, 628). Other element would receive the click:
Upon intense scrutiny I found the problem. The newer browsers somehow generate the datapoints differently and when selecting what I have selected using my code I see:
The Xpath selected point lies in the middle of the two towers hence trying to click on it is not possible for selenium.
For reference I ran the same test on the older version of firefox and I was not surprised by the result as the selected marker now appears exactly at the top of the tower:
Question: Is there a way of selecting the correct chart value with the new version of chrome, because there are not other possible selectors that select the top of the tower (or anywhere on the tower)? Perhaps some way of selecting and then always clicking 2 mm to the left so that I can select the tower.
Old firefox version: 57.0.4
New chrome version: 69.0.3497.100
This question is different than the other asked question in the way that I actually do not have a dom element that can be selected to click, in the other question the dom element exists but is hidden behind another element.