I am trying to run an automation script using Selenium and in this script Robot class's mouseMove method has been used to move mouse cursor to a specific location. When I run this script from eclipse as a Java application or using tomcat (this script is a part of larger framework, which is deployed on tomcat), it is working fine.
But if I run tomcat as a windows service, the same code is not working. There is no error in the server logs, but the mouse cursor is not moving. Please let me know if anyone knows a resolution for this issue.
Following are the lines of code from the script, which produce no result when tomcat is running as a windows service:
WebElement element = driver.findElement(By.id("headerForm:j_id26"));
Actions builder = new Actions(driver);
builder.click(element).build().perform();
Point mousePt = element.getLocation();
int x = (int) mousePt.getX();
int y = (int) mousePt.getY();
Robot robot = new Robot();
robot.mouseMove(x+100, y+110);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);