DEV Community

Cover image for GUI automation with Pyautogui
Anja
Anja

Posted on

4

GUI automation with Pyautogui

Good evening! Do you already know the pyautogui Module? Its a python module that can send virtual keypresses and mouse clicks to your Operating System. Depending on your OS you might have to install different dependencies. For Linux you need to run:

sudo pip3 install python3-xlib
sudo apt-get install scrot 
python3-tk python3-dev
Enter fullscreen mode Exit fullscreen mode

Then you can run pip3 install pyautogui. If your program somehow gets out of control on Linux you can Logout with Ctrl-Alt-Del. Also you can include short pauses into your program so you gain back control of the mouse or keyboard. For the mouse movements you make use of the x and y-coordinates of your screen.

Here are some functions of the PyAutoGUI:

  1. moveTo(x,y)
  2. click(x,y,button)
  3. rightClick()
  4. scroll(units)
  5. press(key)

I also created a video about it here:
Alt Text

Read more about the PyAutoGUI here:

https://automatetheboringstuff.com/2e/chapter20/

What kind of automation tools or frameworks have you already been using? I love automating stuff. :D Have a nice evening!

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay