feat: report new URL after actions that trigger navigation#1853
feat: report new URL after actions that trigger navigation#1853rogeroliveira84 wants to merge 1 commit intoChromeDevTools:mainfrom
Conversation
|
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. |
5a3832c to
d281454
Compare
Lightning00Blade
left a comment
There was a problem hiding this comment.
Thanks for the PR,
there are some comments that would need to be address before we can merge.
|
Hi @rogeroliveira84, thanks for the original PR and the groundwork here! I noticed the review feedback from @Lightning00Blade hadn't been addressed yet, so I went ahead and opened #1954 incorporating those suggestions ( |
|
Hi @Lightning00Blade I have on going work for that was planing to push later on, but once I do you can also check comment on it and see how it goes... cheers! |
Input tools (click, fill, press_key, hover, drag, type_text,
fill_form, click_at) and evaluate_script now append a
"Page navigated to <url>." line to the response when the action
triggers a cross-document navigation.
WaitForHelper.waitForEventsAfterAction returns
{navigatedToUrl?: string} instead of void. The URL is detected by
comparing page.url() before and after the action, which is robust
against timing variations in navigation-start detection.
A shared appendWaitForResult helper is exposed from WaitForHelper
so input.ts and script.ts can both render the navigation line
without duplicating the logic.
Fixes ChromeDevTools#243
3d02f39 to
8c875af
Compare
|
Hi @Lightning00Blade I pushed changes, could review pls. Thanks. |
Summary
click,fill,press_key,hover,drag,type_text,fill_form,click_at) andevaluate_scriptnow append aPage navigated to <url>.line to the response when the action triggers a cross-document navigation.WaitForHelper.waitForEventsAfterActionreturns{navigated: boolean}instead ofvoid, surfacing the navigation signal that was already being detected internally.navigate_pageornew_pagesince they already report the URL explicitly.Fixes #243
Why
Today, if a
clickcauses a page navigation, the response says "Successfully clicked on the element" with no indication that the page URL changed. The agent has to make an extralist_pagescall to discover where it landed. This saves that round-trip for every navigation-triggering action.Design
The existing
waitForNavigationStartedinWaitForHelperalready knows whether a cross-document navigation started. We propagate that signal as{navigated: boolean}through the return value ofwaitForEventsAfterAction→McpPage→ContextPageinterface, and let each handler append the URL line whennavigatedis true.Same-document (history API) navigations remain filtered out by the existing
waitForNavigationStartedlogic, matching current behavior. Click-opens-new-tab is a separate concern (#367).Test plan
Page navigated to <url>.