Pydoll

raw JSON →
2.22.1 verified Fri May 01 auth: no python

Pydoll is a library for automating Chromium-based browsers without a WebDriver, offering realistic interactions. It leverages Chrome DevTools Protocol (CDP) for direct browser control. Version 2.22.1 targets Python 3.10+.

pip install pydoll-python
error ModuleNotFoundError: No module named 'pydoll'
cause Library not installed or installed with wrong name.
fix
Install via 'pip install pydoll-python' (note the hyphen, not underscore).
error AttributeError: module 'pydoll' has no attribute 'Browser'
cause Importing from wrong location; Browser is in submodule.
fix
Use 'from pydoll.browser.chromium import ChromiumBrowser'.
error RuntimeError: Event loop is closed
cause Using asyncio.run() in some contexts or improper async handling.
fix
Ensure you are not mixing asyncio.run() with other event loops. Use await browser.start() properly.
breaking Pydoll v2.x uses async/await exclusively. Synchronous API has been removed. All interactions must be awaitable.
fix Wrap code in async functions and use await for browser/page methods.
gotcha Browser instance does not auto-launch; you must call await browser.start() explicitly before use.
fix Always call await browser.start() after creating the Browser instance.
deprecated The method Browser.find_elements has been deprecated in favor of Page.find_elements for clarity.
fix Use page.find_elements(...) instead of browser.find_elements(...).

Launch Chromium, navigate to a page, and print the HTML source.

import asyncio
from pydoll.browser.chromium import ChromiumBrowser

async def main():
    browser = ChromiumBrowser()
    await browser.start()
    page = await browser.get_page()
    await page.go_to('https://example.com')
    print(await page.get_source())
    await browser.stop()

asyncio.run(main())