I am working on automation project to automate web application testing using Selenium webdriver with Java. However, we have got stuck for moving mouse pointer to required location (x,y) on page. We have used Actions class to achieve this, but this class does not move the mouse pointer on location it is just moving focus of the mouse and we need to mouse over element to open tool tip. We have tried using other framework SIKULI, which work on images, which work fine but it does not go to each and every element/image on page, it select the random image which match it.
However, we have graph on web page which has multiple point which has tool tip which open only when mouse is physical hover on element. Now, we have come across the new thought, that is get the location (x,y) of element on page and using Robot class to move the mouse on required location, but when we pass the (x,y) position of element on page, it move the mouse on some other position on screen, the reason is robot class will take the screen resolution and move the mouse based on (x,y) position.
Can we pragmatically find the exact position based on desktop screen size, for example Web Page size is (3081,5172) and based on webpage element location is (723,415), now what will the position of element on screen when screen size is (1920,1080)?
Till Now below is the code I am using it.
Robot robot=new Robot();
Actions action = new Actions(driver);
action.moveToElement(ele).click().build().perform();
robot.mouseMove(ele.getLocation().getX(), ele.getLocation().getY());
Note: action.moveToElement method does not move the mouse pointer physical on required element and robot.mouseMove method move the mouse with desktop screen which gives incorrect out put.
Your inputs will be highly appreciate