feat: report navigated URL in action responses#1954
Open
masamaru0513 wants to merge 2 commits intoChromeDevTools:mainfrom
Open
feat: report navigated URL in action responses#1954masamaru0513 wants to merge 2 commits intoChromeDevTools:mainfrom
masamaru0513 wants to merge 2 commits intoChromeDevTools:mainfrom
Conversation
ccf84a8 to
ca993a0
Compare
5 tasks
wolfib
reviewed
Apr 29, 2026
Contributor
|
Thanks! This mostly looks good to me, added a few comments. |
Report the new page URL when an action (click, fill, press_key, etc.) triggers a navigation. The URL is detected by comparing the page URL before and after waitForEventsAfterAction. Fixes ChromeDevTools#243
ca993a0 to
b78a69b
Compare
Contributor
Author
|
Thanks for the review @wolfib! Addressed the feedback:
Please take another look when you get a chance. |
Contributor
|
Thanks! The update LGTM, but I defer to @Lightning00Blade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Report the new page URL when an action triggers a navigation, so there is no need to re-query the pages list.
Fixes #243
Changes
McpPage.waitForEventsAfterActionnow compares the page URL before and after the action, returning{navigatedToUrl}when a navigation occurredappendNavigatedToUrlhelper inWaitForHelper.tsfor consistent URL reporting across toolsclick,click_at,hover,fill,fill_form,type_text,drag,press_key) use the helper to appendNavigated to <URL>when a navigation is detectedevaluate_scriptalso reports navigated URLs using the same helpernavigate_pageornew_pagesince they already report the URL explicitlyOutput example
Before:
Successfully clicked on the elementAfter:
Testing
clickon a link → reports navigated URL ✅press_keyEnter on a focused link → reports navigated URL ✅evaluate_scriptwithwindow.location.hrefchange → reports navigated URL ✅evaluate_scriptwithout navigation → no "Navigated to" ✅navigate_pageback/forward → existing behavior preserved ✅