How to Automate Tasks — Robotic Process Automation with Python
In the book “Automating boring things with python”, I got to know a very useful python module: pyautogui. Thanks to this module, you can make simple RPA (robotic process automation) applications yourself, without the need of an expensive tool. This will allow you to do your work more efficiently. It is also very satisfying to see your robot working for you or for a guy in India that you have hired to do your repetitive task.
See how I used RPA to go immediately and automatically to the website, fill out forms and take screenshots.
How to automate keyboard and mouse with python
Once you have installed the pyautogui module (using the
pip install pyautogui command) you can import it using this code.
For moving your mouse you can use this code:
The first number (280) is the X-position on your screen or the amount of pixels on the left, the second number (20) the Y-position on your screen or the amount of pixels from the top. So you can control your mouse with one line of code!
You can emulate mouse clicks with following code:
If you want to type something you can us following code:
pyautogui.write(“I am a bot and I am writing”)
You can also press buttons
So basically with these 2 mouse and 2 keyboard commands you are able to automate form submissions, screenshot, repetitive tasks and so on.
Great! Now save some time and automate your job.
October 5, 2021
February 10, 2021
February 4, 2016