Prompt
How do I automate form filling, clicking, and data export in a browser?
Latest observation
Oct 13, 2026
OpenAI APIWeb search: off
You can automate browser work in a few common ways, depending on how “serious” the workflow is and what browser/site you’re targeting.
Best options
1) Browser automation with Playwright
Best for: modern web apps, reliable form filling, clicking buttons, downloading/exporting files.
Playwright can:
- open a browser
- fill inputs, select dropdowns, click buttons
- wait for pages/network
- handle file downloads
- run headless or visible
Example in Python
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
page.goto("https://example.com/login")
page.fill("#username", "myuser")
page.fill("#password", "mypassword")
page.click("button[type='submit']")
page.wait_for_load_state("networkidle")
page.click("text=Export")
with page.expect_download() as download_info:
page.click("text=Download CSV")
download = download_info.value
download.save_as("output.csv")
browser.close()
Install:
pip install playwright
playwright install
2) Selenium
Best for: older browser automation setups, many examples online, broad support.
Selenium can do the same general tasks:
- fill forms
- click buttons
- navigate pages
- download/export with some extra setup
Example in Python
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://example.com")
driver.find_element(By.ID, "username").send_keys("myuser")
driver.find_element(By.ID, "password").send_keys("mypassword")
driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()
3) Macros / RPA tools
Best for: non-developers or repetitive office workflows.
Examples:
- UiPath
- Power Automate Desktop
- AutoHotkey
- Robot Framework
These are useful if you want:
- record-and-replay style automation
- integration with desktop apps
- less coding
Typical workflow
- Inspect the page
- Use browser dev tools to identify selectors for inputs/buttons.
- Write automation
- Fill fields
- Click controls
- Wait for results
- Handle exports
- Trigger download
- Save file to a known folder
- Validate output
- Check the exported file exists and has expected content
- Run on a schedule
- Use cron, Task Scheduler, or a CI job
Important tips
- Prefer stable selectors:
id,name,data-testid. - Avoid brittle selectors like long absolute XPaths.
- Use explicit waits instead of fixed
sleep()calls. - Handle login, popups, and file-download dialogs.
- If the site uses CAPTCHA or strong bot protection, automation may be blocked.
- Make sure you’re allowed to automate the site per its terms.
If you want a simple recommendation
- Use Playwright if you’re starting fresh.
- Use Selenium if you already know it or the environment expects it.
- Use an RPA tool if you want low-code automation.
If you want, I can give you:
- a complete Playwright script for your exact form,
- a Selenium version, or
- a no-code/low-code approach.