Skip to main content

Overview

Browser Use provides powerful data extraction capabilities:
  • LLM-based extraction - Natural language queries
  • Structured output - Type-safe Pydantic models
  • Zero-cost tools - search_page and find_elements
  • Large content handling - Automatic chunking
  • Link extraction - URLs and hrefs

Basic Extraction

Simple Extract Query

Always explicitly mention “use extract action” in your task for best results.

Structured Output

Use Pydantic models for type-safe extraction:
1

Define Your Schema

2

Pass Schema to Agent

3

Parse Results

Complete Example

Advanced Extraction

Chunked Extraction

For large pages, use start_from_char to extract in chunks:
The agent automatically handles truncation:
  • First call: extracts 0 to 100,000 chars
  • If truncated, response includes next_start_char
  • Agent calls extract again with start_from_char=100000

Custom Extraction Schema

Pass schema directly in the extract action:

Zero-Cost Extraction Tools

These tools don’t use the LLM, so they’re instant and free:

search_page

Find text patterns on the page:
Parameters:
  • pattern: Text or regex pattern to search
  • regex: Set to True for regex patterns
  • case_sensitive: Case-sensitive matching
  • context_chars: Characters of context around matches
  • max_results: Limit results returned
  • css_scope: Search within specific element
Example with regex:

find_elements

Query DOM elements by CSS selector:
Parameters:
  • selector: CSS selector (e.g., .class, #id, tag[attr="value"])
  • attributes: List of attributes to extract
  • include_text: Include element text content
  • max_results: Limit results
Example:

Multi-Page Extraction

Sequential Pages

Pagination with Custom Tool

Table Extraction

Simple Tables

Large Tables with Scrolling

Dynamic Content

Wait for Content Load

Infinite Scroll

AJAX/API Responses

Saving Extracted Data

To CSV

To JSON

To Database

Best Practices

1

Be Specific

Good:
Bad:
2

Use Structured Output

Define Pydantic models for type safety and validation:
3

Handle Large Content

Let the agent handle chunking automatically:
4

Use Zero-Cost Tools When Possible

Troubleshooting

Incomplete Extraction

Increase max_steps:

Extraction Timeouts

Increase timeouts:

Missing Data

Wait for dynamic content:

Next Steps

Structured Output Example

See full working example

Custom Tools

Build extraction tools

Production

Scale extraction workflows

Available Tools

See all extraction tools