Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Feature Request: Add wait mechanisms for JavaScript-heavy pages (SSR/SPA support) #30

@adrianiskandar

Description

@adrianiskandar

When using gomcp with modern JavaScript frameworks (React, Vue, Next.js, TanStack Start,
etc.), the goto tool captures the DOM at DOMContentLoaded before client-side hydration and
async data fetching complete. This results in capturing loading states/skeletons instead
of the actual content.

Current Behavior

goto → chromedp.Navigate() → DOMContentLoaded fires → markdown captures HTML

JS hydration happens AFTER this point
Data fetching happens AFTER this point

For SSR streaming apps, the server sends initial HTML with loading skeletons, and the
actual data renders after JavaScript executes.

Proposed Solution

Add wait options to the goto tool (or as a separate wait tool):

Option A: Parameters on goto
{
"url": "https://example.com",
"wait_until": "networkidle", // "domcontentloaded" | "load" | "networkidle"
"wait_for_selector": ".data-loaded", // CSS selector to wait for
"wait_time": 2000 // Additional wait in ms after navigation
}

Option B: Separate wait tool
// New tool: wait
{
"type": "selector", // "selector" | "time" | "network"
"value": ".my-element" // selector string or milliseconds
}

ChromeDP supports these patterns

// Wait for network idle
chromedp.Navigate(url),
chromedp.WaitReady("body"),

// Wait for specific selector
chromedp.WaitVisible(".data-table", chromedp.ByQuery),

// Wait for network to be idle
chromedp.ActionFunc(func(ctx context.Context) error {
return page.SetLifecycleEventsEnabled(true).Do(ctx)
}),

Use Cases

  • Testing React/Vue/Svelte SPAs
  • SSR streaming frameworks (Next.js, TanStack Start, Nuxt)
  • Pages with async data loading (React Query, SWR)
  • Any page where content loads after initial HTML

Environment

  • gomcp version: 1.0.4
  • Lightpanda browser: latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions