Useful ToolsBrowserAutomation
DocsUseful ToolsBrowserAutomation

BrowserAutomation

Natural language browser automation via Playwright. Navigate, click, type, screenshot — describe what you want, no CSS selectors needed.

Log in once, sessions persist in ~/.co/browser_profile/. Uses a vision LLM to find elements by description.

Installation

code
pip install playwright playwright install chromium

Quick Start

With an agent

main.py
from connectonion import Agent from connectonion.useful_tools.browser_tools import BrowserAutomation browser = BrowserAutomation() agent = Agent("web", tools=[browser], model="co/gemini-2.5-pro") agent.input("go to news.ycombinator.com and get the top 5 story titles")

Direct usage

main.py
from connectonion.useful_tools.browser_tools import BrowserAutomation with BrowserAutomation() as browser: browser.go_to("https://example.com") browser.click("the contact button") browser.keyboard_type("hello@example.com") browser.keyboard_press("Enter") browser.take_screenshot("result.png")

API Reference

Navigation

  • go_to(url)
  • get_current_url()
  • get_text()
  • get_links_from_page(filter?)

Interaction

  • click(description)
  • keyboard_type(text)
  • keyboard_press(key)
  • scroll(times?, description?)

Screenshot

  • take_screenshot(path?, full_page?)
  • set_viewport(width, height)

Waiting

  • wait(seconds)
  • wait_for_element(description)
  • wait_for_text(text)
  • wait_for_manual_login(site)

Persistent Sessions

Log in once — cookies and sessions persist to ~/.co/browser_profile/ automatically:

main.py
# First run — log in manually browser = BrowserAutomation() browser.go_to("https://x.com") browser.wait_for_manual_login("X.com") # You handle 2FA/CAPTCHA # Session saved automatically # Every run after — already logged in browser = BrowserAutomation() browser.go_to("https://x.com") # Session restored

Screenshots

main.py
# Returns base64 image (saved to .tmp/ automatically) browser.take_screenshot() # Custom filename browser.take_screenshot("login_page.png") # Full page capture browser.take_screenshot(full_page=True) # Headless vs visible BrowserAutomation(headless=True) # Default — runs in background BrowserAutomation(headless=False) # Open visible window

Star us on GitHub

If ConnectOnion saves you time, a ⭐ goes a long way — and earns you a coffee chat with our founder.