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 @@ -617,25 +617,19 @@ export class McpContext implements Context {
617617 return this . #networkCollector. getIdForResource ( request ) ;
618618 }
619619
620- waitForTextOnPage ( {
621- text,
622- timeout,
623- } : {
624- text : string ;
625- timeout ?: number | undefined ;
626- } ) : Promise < Element > {
620+ waitForTextOnPage ( text : string , timeout ?: number ) : Promise < Element > {
627621 const page = this . getSelectedPage ( ) ;
628622 const frames = page . frames ( ) ;
629623
630- const locator = this . #locatorClass. race (
624+ let locator = this . #locatorClass. race (
631625 frames . flatMap ( frame => [
632626 frame . locator ( `aria/${ text } ` ) ,
633627 frame . locator ( `text/${ text } ` ) ,
634628 ] ) ,
635629 ) ;
636630
637631 if ( timeout ) {
638- locator . setTimeout ( timeout ) ;
632+ locator = locator . setTimeout ( timeout ) ;
639633 }
640634
641635 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