Skip to main content
GSD Browser gives you precise control over every network request the browser makes. You can mock API responses to test edge cases, block analytics and ad traffic to keep automation clean, capture a full HAR file for debugging, run a CDP trace for performance profiling, or inspect the live network log at any time. All network control commands work in both CLI and MCP contexts and apply immediately to the current browser session.

Mock API Routes

Return a fixed response for any URL pattern without hitting a real server:
Simulate error states and loading delays:
Remove all active mocks when you are done:
Route mocks apply to the current session only. They are cleared automatically when the session ends. Always call clear-routes before switching to a different test scenario within the same session.

Block URLs

Prevent specific requests from leaving the browser entirely. This is useful for eliminating analytics noise, ad networks, and third-party tracking during automation:
Blocking analytics and ad URLs during test runs reduces flakiness caused by third-party request timeouts. Add a block-urls call at the start of any test session that visits pages with heavy third-party scripts.

Export a HAR File

Export all captured network traffic for the current session as a HAR 1.2 JSON file. GSD Browser records every request automatically — export the buffer at any point:
Open the resulting .har file in HAR Analyzer or import it directly into browser DevTools for inspection.
The network buffer accumulates continuously. Call gsd-browser network --clear if you want to reset the capture window before a specific flow, then export with har-export afterward.

Run a CDP Trace

Capture a Chrome DevTools Protocol performance trace for deep profiling of rendering, scripting, and network timing:
1

Start tracing

2

Perform the flow you want to profile

Navigate, interact, and exercise the code paths you want to measure.
3

Stop and save

Load the output file in chrome://tracing or Perfetto to visualize the timeline.

Inspect the Network Log

Read the current network log at any time without exporting a full HAR:
Combine with --json for programmatic parsing:

Use Cases

Test against mock APIs

Set up route mocks before navigating so your automation runs against controlled data — no test accounts, seeding, or teardown required.

Block noise during automation

Block analytics, ad, and telemetry URLs to eliminate flakiness from slow third-party requests and keep your HAR files clean and focused.

Capture traffic for debugging

Use har-export after a problematic flow to capture every request. Share the .har file with your team or attach it to a bug report.

Performance profiling

Use CDP traces alongside HAR captures to correlate network timing with rendering and scripting bottlenecks on complex pages.

Common Patterns