Skip to content
Cascading Labs QScrape VoidCrawl Yosoi

Example: Basic Navigation

The simplest VoidCrawl use case: open a browser, navigate to a URL, and read the page.

Code

import asyncio
from voidcrawl import BrowserPool, PoolConfig
async def main() -> None:
async with BrowserPool(PoolConfig()) as pool, pool.acquire() as tab:
await tab.goto("https://qscrape.dev")
title = await tab.title()
url = await tab.url()
html = await tab.content()
print(f"Title: {title}")
print(f"URL: {url}")
print(f"HTML length: {len(html)} chars")
if __name__ == "__main__":
asyncio.run(main())

What’s Happening

  1. BrowserPool(PoolConfig()) creates a pool with default settings (1 browser, 4 tabs).
  2. pool.acquire() checks out a tab from the pool.
  3. tab.goto() sends the browser to the URL and waits for network idle, returning a PageResponse. (If you want to drive the wait yourself, use tab.navigate() and pair it with wait_for_navigation() or a selector wait — both are useful but not interchangeable.)
  4. tab.title(), tab.url(), and tab.content() read page state from the live DOM.
  5. When the async with block exits, the tab is released back to the pool for reuse.

Expected Output

Title: qScrape
URL: https://qscrape.dev/
HTML length: 1256 chars