feat: report navigated URL in action responses#1954
Open
masamaru0513 wants to merge 1 commit intoChromeDevTools:mainfrom
Open
feat: report navigated URL in action responses#1954masamaru0513 wants to merge 1 commit intoChromeDevTools:mainfrom
masamaru0513 wants to merge 1 commit intoChromeDevTools:mainfrom
Conversation
d58c34c to
ccf84a8
Compare
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
ccf84a8 to
ca993a0
Compare
5 tasks
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_page(urltype) now reports the final URL after redirects instead of the requested URLnew_pagenow reports the navigated URL in the response messageOutput example
Before:
After:
Testing
navigate_pagereports final URLclickon 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_pagereports final URL (with trailing slash after redirect) ✅navigate_pageback/forward → existing behavior preserved ✅