Skip to content

pydollvsbrowser-use

MIT 22 7 7,155
86.5 thousand (month) Jun 01 2024 3.0.1(2026-11-08 11:38:44 ago)
122,292 30 600 MIT
Nov 01 2024 7.9 million (month) 1.0.9(2026-11-26 23:16:49 ago)

Pydoll is a Python library for browser automation that uses the Chrome DevTools Protocol (CDP) directly, designed to be undetectable by anti-bot systems. Unlike Selenium-based tools, Pydoll does not use WebDriver and avoids the common detection vectors that anti-bot systems look for.

Key features include:

  • Native CDP communication Connects directly to Chrome/Chromium via CDP websocket without intermediary drivers, avoiding the automation flags and fingerprints that WebDriver-based tools leave behind.
  • Event-driven architecture Built around an async event system that can listen for and react to browser events like network requests, console messages, and DOM changes.
  • Network interception Can intercept, modify, and mock network requests and responses, useful for blocking unnecessary resources or modifying API responses during scraping.
  • Async-first design Fully asynchronous API built on Python's asyncio for efficient concurrent automation.
  • Clean API Provides a high-level, Pythonic API for common browser automation tasks while still allowing direct CDP command execution for advanced use cases.
  • Multi-browser support Can manage multiple browser instances and pages concurrently.

Pydoll fills a similar niche to nodriver and camoufox — browser automation with a focus on avoiding detection — but takes a different approach by providing more granular control over CDP communication and network interception.

Browser-use is a Python library that enables AI agents to control web browsers using natural language instructions. It connects large language models (LLMs) to browser automation, allowing you to describe what you want done in plain English instead of writing explicit selectors and interaction code.

Key features include:

  • Natural language browser control Describe tasks like "go to Amazon and find the cheapest laptop under $500" and the AI agent will navigate, interact with elements, and extract the requested information.
  • Multi-step task execution Can handle complex workflows that require multiple pages, form filling, clicking, scrolling, and waiting for dynamic content.
  • Vision support Uses screenshot analysis (multimodal LLMs) to understand page layout and find elements visually, not just through DOM inspection.
  • Multiple LLM providers Works with OpenAI, Anthropic Claude, Google Gemini, and other LLM providers.
  • Playwright backend Uses Playwright under the hood for reliable browser automation across Chrome, Firefox, and Safari.
  • Structured output Can return extracted data in structured formats defined by Pydantic models.

Browser-use represents a new paradigm in web scraping where instead of writing brittle selectors, you describe the extraction task and let the AI figure out how to navigate and extract the data. This is especially useful for scraping diverse sites with varying layouts.

Highlights


anti-detectcdpasync
ai-powerednatural-languageasync

Example Use


import asyncio
from pydoll.browser import Chrome
from pydoll.constants import By

async def main():
    async with Chrome() as browser:
        # Open a new page
        page = await browser.new_page()
        await page.go_to("https://example.com")

        # Find and interact with elements
        search_input = await page.find_element(By.CSS, "input[name='q']")
        await search_input.type_text("web scraping")

        submit_btn = await page.find_element(By.CSS, "button[type='submit']")
        await submit_btn.click()

        # Wait for results and extract content
        await page.wait_element(By.CSS, ".results")
        results = await page.find_elements(By.CSS, ".result-item")

        for result in results:
            title = await result.get_text()
            print(title)

        # Network interception example
        await page.enable_network_interception()
        # intercept and analyze API calls made by the page

asyncio.run(main())
from browser_use import Agent
from langchain_openai import ChatOpenAI
import asyncio

async def main():
    # Create an AI agent with a language model
    agent = Agent(
        task="Go to reddit.com/r/webscraping, find the top 5 posts "
             "from today, and extract their titles and scores",
        llm=ChatOpenAI(model="gpt-4o"),
    )

    # Run the agent - it navigates and extracts automatically
    result = await agent.run()
    print(result)

    # More complex multi-step task
    agent = Agent(
        task="Go to example.com/login, log in with user@test.com "
             "and password 'test123', then navigate to the dashboard "
             "and extract all notification messages",
        llm=ChatOpenAI(model="gpt-4o"),
    )
    result = await agent.run()
    print(result)

asyncio.run(main())

Alternatives / Similar


Was this page helpful?