title: How to move cursor position using WebDriver
body: <p>I am working on a Liferay 6.2 project. In Liferay, they used Vaadin. When I click on a button it opens with a different iframe. I can code that all functionality. Now I want to move the cursor to the iframe element using WebDriver. Because when I move mouse to the iframe checkbox after that my automate script can run. I want to automate a script to move the mouse pointer to the the element.</p>
  
  <p>I have tried the code below, but it doesn't work.</p>
  
  <p>1) using <code>Action moveToElement</code>:</p>
  
  <pre><code>driver.findElement(By.xpath("element1")).click();
  new Actions(driver).moveToElement(driver.findElement(By.xpath("element2"))).click().perform();
  </code></pre>
  
  <p>2) using <code>mouseMove</code></p>
  
  <pre><code>WebElement element = driver.findElement(By.xpath("element xpath"));
  Locatable hoverItem = (Locatable) element;
  Mouse mouse = ((HasInputDevice) driver).getMouse();
  mouse.mouseMove(hoverItem.getCoordinates());
  </code></pre>
  
  <blockquote>
    <p>error: getting a error in ((HasInputDevice) driver).
    HasInputDevice cannot be resolved to a type</p>
  </blockquote>
  
  <p>3)</p>
  
  <pre><code>Locatable hoverItem = (Locatable) driver.findElement(By.xpath("element xpath"));
  int y = hoverItem.getCoordinates().getLocationOnScreen().getY();
  ((JavascriptExecutor)driver).executeScript("window.scrollBy(0,"+y+");");
  </code></pre>
  
  <blockquote>
    <p>error: getting a error in getLocationOnScreen()
    The method getLocationOnScreen() is undefined for the type Coordinates</p>
  </blockquote>
  
  <p>4)</p>
  
  <pre><code>Point coordinates = driver.findElement(By.xpath("element xpath")).getLocation();
  Robot robot = new Robot();
  WebElement markNews = driver.findElement(By.xpath("element xpath"));
  markNews.click();
  robot.mouseMove(coordinates.x,coordinates.y+80);
  </code></pre>
  
  <p>This does not work.</p>
  
  <p>I just want to move cursor point to the iframe locator.</p>