I have an application developed by using Vaadin Framework, Now i need to click on the rectangular polygon which is on the Canvas.following is the html code here i am providing the Html code
<canvas width="1920" height="524" class="ol-unselectable" style="width: 100%; height: 100%;"></canvas>
and i tried by using Actions which makes the mouse move over the Polygon and click .
int x = (int) 5638326.333511386;
int y = (int) 2580101.9711508946;
driver.get("http://localhost:8080/internship");
WebElement ele = driver.findElement(By.xpath("//canvas[@class='ol-unselectable']"));
// driver.findElement(By.tagName("canvas"));
//driver.findElemet(By.className("ol-unselectable"));
try {
Actions builder = new Actions(driver);
builder.moveToElement(ele, x, y);
builder.clickAndHold();
builder.release();
builder.perform();
} catch (Exception e) {
// do nothing
}
i am getting the foloowing error
org.openqa.selenium.NoSuchElementException: Unable to locate element: //canvas[@class='ol-unselectable'].
can anyone suggest some samples how to find polygon on canvas with co-ordinates and make click on it.