xdotool lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions.
in terminal:
sudo apt-get install xdotool
Send a click, that is, a mousedown followed by mouseup for the given button with a short delay between the two (currently 12ms).
Buttons generally map this way:
Left mouse is 1, middle is 2, right is 3, wheel up is 4, wheel down is 5.
Specify how many times to click. Default is 1.
For a double-click,
use --repeat 2
Move the mouse to the specific X and Y coordinates on the screen.
You can move the mouse to the previous location if you specify 'restore' instead of an X and Y coordinate. Restoring only works if you have moved previously in this same command invocation. Further, it does not work with the --window option.
For example, to click the top-left corner of the screen and move the mouse to the original position before you moved it, use this: xdotool mousemove 0 0 click 1 mousemove restore
to get specific X and Y location of the mouse
xdotool getmouselocation --shell
example:
% xdotool getmouselocation --shell
X=880
Y=443
SCREEN=0
WINDOW=16777250
Sleep for a specified period. Fractions of seconds (like 1.3, or 0.4) are valid
sleep 1
touch template.sh
nano template.sh
write this inside template.sh
#!/usr/local/bin/xdotool
xdotool sleep 30 mousemove 906 77 click 1 sleep 5 mousemove 509 523 click 1
source: