File tree Expand file tree Collapse file tree 3 files changed +8
-14
lines changed
Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -625,25 +625,19 @@ export class McpContext implements Context {
625625 return this . #networkCollector. getIdForResource ( request ) ;
626626 }
627627
628- waitForTextOnPage ( {
629- text,
630- timeout,
631- } : {
632- text : string ;
633- timeout ?: number | undefined ;
634- } ) : Promise < Element > {
628+ waitForTextOnPage ( text : string , timeout ?: number ) : Promise < Element > {
635629 const page = this . getSelectedPage ( ) ;
636630 const frames = page . frames ( ) ;
637631
638- const locator = this . #locatorClass. race (
632+ let locator = this . #locatorClass. race (
639633 frames . flatMap ( frame => [
640634 frame . locator ( `aria/${ text } ` ) ,
641635 frame . locator ( `text/${ text } ` ) ,
642636 ] ) ,
643637 ) ;
644638
645639 if ( timeout ) {
646- locator . setTimeout ( timeout ) ;
640+ locator = locator . setTimeout ( timeout ) ;
647641 }
648642
649643 return locator . wait ( ) ;
Original file line number Diff line number Diff line change @@ -107,10 +107,7 @@ export type Context = Readonly<{
107107 filename : string ,
108108 ) : Promise < { filename : string } > ;
109109 waitForEventsAfterAction ( action : ( ) => Promise < unknown > ) : Promise < void > ;
110- waitForTextOnPage ( params : {
111- text : string ;
112- timeout ?: number | undefined ;
113- } ) : Promise < Element > ;
110+ waitForTextOnPage ( text : string , timeout ?: number ) : Promise < Element > ;
114111 getDevToolsData ( ) : Promise < DevToolsData > ;
115112 /**
116113 * Returns a reqid for a cdpRequestId.
Original file line number Diff line number Diff line change @@ -53,7 +53,10 @@ export const waitFor = defineTool({
5353 ...timeoutSchema ,
5454 } ,
5555 handler : async ( request , response , context ) => {
56- await context . waitForTextOnPage ( request . params ) ;
56+ await context . waitForTextOnPage (
57+ request . params . text ,
58+ request . params . timeout ,
59+ ) ;
5760
5861 response . appendResponseLine (
5962 `Element with text "${ request . params . text } " found.` ,
You can’t perform that action at this time.
0 commit comments