I have an image in which I can click on an area & it crop the image from the center of your click.

I.e you click the middle of the image it will crop from that point.

I was wondering if there was anything in Selenium (Java) where you can click at specific co-ordinates of an image.


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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.