This is a bash script, as an example, on how to do click-testing GUI based on finding components based on how they look.
- opencv
- scrot
- findimage
- xdotool
https://gist.github.com/eirikb/ac8196beb0b57577a8fc47eb18427bd4
This is a bash script, as an example, on how to do click-testing GUI based on finding components based on how they look.
https://gist.github.com/eirikb/ac8196beb0b57577a8fc47eb18427bd4
| #!/bin/bash | |
| function click { | |
| scrot out.png | |
| pos=$(findimage out.png $1) | |
| x=$(echo $pos | grep -oP "\d+:" | grep -oP "\d+") | |
| y=$(echo $pos | grep -oP ":\d+" | grep -oP "\d+") | |
| size=$(file $1) | |
| width=$(echo $size | grep -oP "\d+ x" | grep -oP "\d+") | |
| height=$(echo $size | grep -oP "x \d+" | grep -oP "\d+") | |
| x=$(expr $x + $width / 2) | |
| y=$(expr $y + $height / 2) | |
| echo "click $x $y" | |
| xdotool mousemove $x $y click 1 | |
| } | |
| click 1.png | |
| sleep 1s | |
| click 2.png | |
| sleep 1s | |
| click 3.png |