Selenium: How to click at x,y coordinates?



  • I want to click at x, y coordinates like 52, 216-52, 295. How can this be done using Selenium? (I am using Mac OSX 10.8.5 with Selenium 2.40.0 and Firefox version 29.0)



  • You can move the mouse and click with Actions, given you have a element to offset from. You cannot click outside the browser content window or control Operating System elements. moveToElement(WebElement toElement, int xOffset, int yOffset) Moves the mouse to an offset from the top-left corner of the element. The code (Java) would look like this: Actions builder = new Actions(driver); builder.moveToElement(knownElement, 10, 25).click().build().perform();



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2