How to click on a moving Image

There is an Image in my application that keeps on moving.
I want to click that image.
Click command does not work properly in my case as the time between eggplant locates the image and tries to click it the image moves to other location.

Thanks and regards

How is the image moving? If it’s bouncing around somewhat randomly like the Windows logo in a screensaver or if its speed isn’t consistent, then it’s going to be a challenge. But if it’s moving in a predefined direction at a constant speed then you could try using a relative hotspot:


Image moving this way
-------------------------->              put Hot Spot here

     -----------------
    |     IMAGE       |                                 +
     -----------------

So the suggestion is that eggPlant finds the image and then clicks in the area it’s heading to, like leading a clay pigeon when skeet shooting. You’d probably have to make some adjustments to the position of the Hot Spot, but if the speed is consistent and the image is large enough to allow a little bit of “slop” then I think this could work.

If the object’s movements are less well defined, you could try finding it twice and using those positions to calculate its path and speed and then predict where to click based on those values, but I’d be surprised if this approach yielded consistent results.