Skip to content

navigate_page timeout parameter is not respected by WaitForHelper #863

@89lovelc

Description

@89lovelc

Description of the bug

Bug: navigate_page timeout parameter is not respected by WaitForHelper

Description

The navigate_page tool accepts a timeout parameter, but the actual navigation timeout is hardcoded to 3000 * networkTimeoutMultiplier ms in WaitForHelper.js. The user-provided timeout value is not passed to the internal waitForNavigation call.

Steps to Reproduce

  1. Call navigate_page with a custom timeout:
{
  "type": "url",
  "url": "https://example.com",
  "timeout": 30000
}
  1. Observe the logs:
navigate_page request: {
  "type": "url",
  "url": "https://example.com",
  "timeout": 30000
}
navigate_page context: resolved
Detecting open DevTools windows
TimeoutError: Navigation timeout of 3000 ms exceeded

Expected Behavior

The navigation should wait for 30000ms (as specified in the request) before timing out.

Actual Behavior

The navigation times out after 3000ms, ignoring the user-provided timeout parameter.

Root Cause Analysis

In WaitForHelper.js:

// Line 14-18: Constructor sets fixed timeout
constructor(page, cpuTimeoutMultiplier, networkTimeoutMultiplier) {
    this.#navigationTimeout = 3000 * networkTimeoutMultiplier;  // ← Fixed value
    // ...
}

// Line 109-112: waitForEventsAfterAction uses the fixed timeout
return this.#page.waitForNavigation({
    timeout: this.#navigationTimeout,  // ← Uses fixed value, ignores user input
    signal: this.#abortController.signal,
});

In pages.js, the navigate_page handler:

// Line 129: User timeout is passed to options
const options = {
    timeout: request.params.timeout,
};

// Line 164: page.goto receives the options
await page.goto(request.params.url, options);

However, context.waitForEventsAfterAction() wraps the navigation and calls waitForNavigation with its own fixed timeout, which overrides the user's setting.

Suggested Fix

Pass the timeout parameter from the request to WaitForHelper:

// In McpContext.js or pages.js
async waitForEventsAfterAction(action, options = {}) {
    const timeout = options.timeout ?? this.#navigationTimeout;
    // Use this timeout in waitForNavigation
}

Or modify WaitForHelper constructor/method to accept a timeout override.

Environment

  • chrome-devtools-mcp version: 0.15.0
  • OS: macOS
  • Node.js version: 20.x

Related Issues


Thank you for the great tool! 🙏

Reproduction

No response

Expectation

No response

MCP configuration

No response

Chrome DevTools MCP version

0.15.0

Chrome version

No response

Coding agent version

No response

Model version

No response

Chat log

No response

Node version

No response

Operating system

None

Extra checklist

  • I want to provide a PR to fix this bug

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions