File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -364,7 +364,6 @@ export class McpContext implements Context {
364364 const networkMultiplier = getNetworkMultiplierFromString (
365365 this . getNetworkConditions ( ) ,
366366 ) ;
367-
368367 const waitForHelper = this . getWaitForHelper (
369368 page ,
370369 cpuMultiplier ,
Original file line number Diff line number Diff line change @@ -126,18 +126,22 @@ export class WaitForHelper {
126126 async waitForEventsAfterAction (
127127 action : ( ) => Promise < unknown > ,
128128 ) : Promise < void > {
129- const navigationStartedPromise = this . waitForNavigationStarted ( ) ;
129+ const navigationFinished = this . waitForNavigationStarted ( )
130+ . then ( navigationStated => {
131+ if ( navigationStated ) {
132+ return this . #page. waitForNavigation ( {
133+ timeout : this . #navigationTimeout,
134+ signal : this . #abortController. signal ,
135+ } ) ;
136+ }
137+ return ;
138+ } )
139+ . catch ( error => logger ( error ) ) ;
130140
131141 await action ( ) ;
132142
133143 try {
134- const navigationStated = await navigationStartedPromise ;
135- if ( navigationStated ) {
136- await this . #page. waitForNavigation ( {
137- timeout : this . #navigationTimeout,
138- signal : this . #abortController. signal ,
139- } ) ;
140- }
144+ await navigationFinished ;
141145
142146 // Wait for stable dom after navigation so we execute in
143147 // the correct context
You can’t perform that action at this time.
0 commit comments