Xdotool is a program that can simulate keyboard and mouse events. It can be used to establish real “scenarios” action replay. Unlike randtype seen recently xdotool not confined to the terminal. It is also able to manipulate the windows of your graphical environment.
For rpm-based distribution, open a terminal as root and run the following command:
yum install xdotool
Or this one for a distrbution based on Debian:
sudo apt-get install xdotool
Examples of using xdotool
Xdotool can be used in command line for simple actions. The-h you will get help.
But in most cases, you will need to combine multiple events. Using a script will be the best solution. Here is an example of what can be achieved with:
WID=`xdotool search –title “Mozilla Firefox” | head -1`
xdotool windowfocus $WID
xdotool key ctrl+l
xdotool type “www.redcodenetwork.ro”
xdotool key “Return”
This script makes in order the following actions:
* Search the id of the Firefox window
* Switch to that window
* Use keyboard shortcut Ctrl + l – to select the addressbar
* Write the address of redCode Net.Work
* press the enter key
We could have gone even further, by moving the mouse cursor and clicking on a link:
xdotool mousemove 500 500
xdotool click 1
Xdotool possibilities are interesting. Feel free to create your own scenarios.