π‘ The robot that fills out forms so you don't have to.
π Welcome! This is my main public repository: a growing collection of examples and functions to help with your day-to-day work as a developer, scientist, or researcher.
Note
Be careful when running this on your PC.
Tip
A random testing system was used, which may no longer be working - you can switch to another one.
fill_form_tool is a tiny, fearless automation script. You give it a spreadsheet of products and a login page, and it sits down at your computer, takes the keyboard, and types like a tireless intern who never asks for a lunch break.
It opens Chrome, logs in, reads produtos.csv, and registers all 293 products β one by one, tab by tab, click by click β while you watch in quiet admiration (or mild terror, the first time).
This script controls your real mouse and keyboard. It is not a metaphor. When it runs, your computer is possessed β gently, politely, but fully possessed.
A few sacred rules:
- Don't touch anything while it runs. The robot does not negotiate.
- Coordinates are hardcoded (
x=685, y=451and friends). They were measured on one specific screen. Yours is probably different. - Slam the mouse into a screen corner to abort. PyAutoGUI's emergency brake. Memorize this. Love this.
pip install pyautogui pandasYou'll also need:
produtos.csvβ your product base (293 rows, 7 columns:codigo,marca,tipo,categoria,preco_unitario,custo,obs)- A login page that accepts your credentials and a form that accepts your patience
The script moves through five graceful acts:
| Step | What happens | Mood |
|---|---|---|
| 1. Open the stage | Presses win, types chrome, opens the login URL |
Curtains up |
| 2. Log in | Clicks the email field, types email, tab, types password, clicks login |
The handshake |
| 3. Read the data | pandas loads produtos.csv into a tidy table |
The homework |
| 4. Register each product | Loops every row: click β type β tab β repeat β enter β scroll up |
The marathon |
| 5. Repeat until done | Does it again. And again. 293 times. Without complaint. | Zen |
The coordinates won't match your screen. Use the companion script to find the real ones:
import time
import pyautogui
time.sleep(5) # 5 seconds to hover over the field you want
print(pyautogui.position()) # prints (x, y) β write these down
pyautogui.scroll(200)Run it, hover your cursor over each field, read the coordinates, and update the pyautogui.click(x=..., y=...) lines in fill_form_tool.py. Think of it as teaching the robot where its hands go.
python fill_form_tool.pyThen step away. Make tea. Watch a small machine do an honest day's work.
- Adjust
pyautogui.PAUSE(currently0.3) if your site loads slowly β too fast and the robot types into the void. - The
obscolumn is checked for empty values before typing, because even robots respect blank fields. - The final
pyautogui.scroll(5000)resets the page to the top before the next product. Tidy.
Made with affection and a slightly haunted keyboard by EVA.
** | Don't touch the mouse.**