Skip to content

fix(input): include page list when click opens new tab#964

Closed
SucRunBug wants to merge 1 commit intoChromeDevTools:mainfrom
SucRunBug:codex/issue-367-click-open-pages
Closed

fix(input): include page list when click opens new tab#964
SucRunBug wants to merge 1 commit intoChromeDevTools:mainfrom
SucRunBug:codex/issue-367-click-open-pages

Conversation

@SucRunBug
Copy link
Copy Markdown

Summary

Fixes a UX gap where click/click_at can open a new tab but the tool response doesn't include updated page context, making it hard for agents to detect that navigation happened in a new page.

Closes #367.

What changed

  • Updated /Users/yanmai/Downloads/MCP 测试/chrome-devtools-mcp/src/tools/input.ts:

    • click: listens for popup during the action and calls response.setIncludePages(true) if a new tab/window is opened.
    • click_at: same behavior as click.
    • Ensures popup listeners are cleaned up in finally blocks.
  • Updated /Users/yanmai/Downloads/MCP 测试/chrome-devtools-mcp/tests/tools/input.test.ts:

    • Added includes pages if click opens a new tab
    • Added includes pages if click at coordinates opens a new tab

Why this approach

  • Keeps existing behavior unchanged for normal clicks.
  • Only includes page list when a new page is actually opened, minimizing response noise.

Validation

  • npm run typecheck
  • npx eslint src/tools/input.ts tests/tools/input.test.ts
  • Targeted tests for the new scenarios and related click flows

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Feb 14, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@OrKoN
Copy link
Copy Markdown
Collaborator

OrKoN commented Feb 18, 2026

Thanks I think the change makes sense in general. Could you please sign the CLA?

@OrKoN OrKoN self-requested a review February 18, 2026 13:11
Comment thread src/tools/input.ts
};
page.on('popup', popupListener);
try {
await context.waitForEventsAfterAction(async () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's embed it into waitForEventsAfterAction since not only clicks can trigger a popup?

@OrKoN
Copy link
Copy Markdown
Collaborator

OrKoN commented Feb 26, 2026

Closing as stale.

@OrKoN OrKoN closed this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

return all pages when click web element

2 participants