Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Document page-context browser fetch helper

Magnus Müller1ddf109ef4ef
diff --git a/RUST_AGENT_INTEGRATION_FEATURES.md b/RUST_AGENT_INTEGRATION_FEATURES.md
index 0f3c2d4dd..2d7a4c8d2 100644
--- a/RUST_AGENT_INTEGRATION_FEATURES.md
+++ b/RUST_AGENT_INTEGRATION_FEATURES.md
@@ -241,6 +241,11 @@ Terminal core branch: `magnus/browser-use-rust-integration` at latest pulled mai
- The helper fetches static page/API URLs concurrently while preserving input order and returning compact per-URL success, status, headers, text/content, and error records so one blocked URL does not discard the whole batch.
- Proof: `browser_script_http_get_many_preserves_order_errors_and_binary`.
+47. Browser-script page-context fetch helper
+ - Terminal browser scripts now expose `browser_fetch(url, headers=None, method="GET", body=None, timeout=20.0, binary=False)`.
+ - The helper runs `fetch(...)` in the current page context with browser credentials, timeout aborting, JSON parsing, and binary base64 output for sites where direct HTTP is blocked but the loaded page has cookies or same-origin API access.
+ - Proof: `browser_script_browser_fetch_uses_page_context_credentials`.
+
## Current Verification
- `python3 -m py_compile browser_use/rust/service.py browser_use/rust/__init__.py browser_use/__init__.py tests/ci/test_rust_agent.py examples/rust_agent/basic.py examples/rust_agent/real_v8_smoke.py`
@@ -265,6 +270,7 @@ Terminal core branch: `magnus/browser-use-rust-integration` at latest pulled mai
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_arxiv_query_normalizes_atom_metadata -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_grid_row_helpers_surface_row_scoped_actions -- --nocapture`
- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_http_get_many_preserves_order_errors_and_binary -- --nocapture`
+- `CARGO_INCREMENTAL=0 cargo test -q -p browser-use-browser browser_script_browser_fetch_uses_page_context_credentials -- --nocapture`
- Managed-headless end-to-end:
- `BROWSER_USE_TERMINAL_BINARY=/home/exedev/Developer/terminal/target/debug/browser-use-terminal BROWSER_USE_RUST_BROWSER_MODE=managed-headless BU_TASK='Open https://example.com and report the page title only.' BU_MAX_STEPS=12 timeout 300 uv run python examples/rust_agent/basic.py`
- Output: `Example Domain`