@@ -141,6 +141,7 @@ export default class Tab extends TypedEventEmitter<ITabEventParams> {
141141 this . waitForLocation ,
142142 this . waitForNewTab ,
143143 this . waitForResource ,
144+ // DO NOT ADD waitForReady
144145 ] ) ;
145146 }
146147
@@ -226,7 +227,7 @@ export default class Tab extends TypedEventEmitter<ITabEventParams> {
226227 let finalResourceId = resourceid ;
227228 // if no resource id, this is a request for the default resource (page)
228229 if ( ! resourceid ) {
229- await this . waitForLoad ( 'READY' ) ;
230+ await this . locationTracker . waitFor ( 'READY' ) ;
230231 finalResourceId = await this . locationTracker . waitForLocationResourceId ( ) ;
231232 }
232233
@@ -294,7 +295,7 @@ export default class Tab extends TypedEventEmitter<ITabEventParams> {
294295 ) : Promise < IExecJsPathResult < T > > {
295296 // if nothing loaded yet, return immediately
296297 if ( ! this . navigationTracker . top ) return null ;
297- await this . waitForLoad ( 'READY' ) ;
298+ await this . locationTracker . waitFor ( 'READY' ) ;
298299 return this . domEnv . execJsPath < T > ( jsPath , propertiesToExtract ) ;
299300 }
300301
@@ -307,12 +308,12 @@ export default class Tab extends TypedEventEmitter<ITabEventParams> {
307308 }
308309
309310 public async getLocationHref ( ) : Promise < string > {
310- await this . waitForLoad ( 'READY' ) ;
311+ await this . locationTracker . waitFor ( 'READY' ) ;
311312 return this . domEnv . locationHref ( ) ;
312313 }
313314
314315 public async getCookies ( ) : Promise < ICookie [ ] > {
315- await this . waitForLoad ( 'READY' ) ;
316+ await this . locationTracker . waitFor ( 'READY' ) ;
316317 return await this . session . browserContext . getCookies (
317318 new URL ( this . puppetPage . mainFrame . securityOrigin ?? this . puppetPage . mainFrame . url ) ,
318319 ) ;
@@ -323,7 +324,7 @@ export default class Tab extends TypedEventEmitter<ITabEventParams> {
323324 value : string ,
324325 options ?: ISetCookieOptions ,
325326 ) : Promise < boolean > {
326- await this . waitForLoad ( 'READY' ) ;
327+ await this . locationTracker . waitFor ( 'READY' ) ;
327328 await this . session . browserContext . addCookies ( [
328329 {
329330 name,
@@ -431,7 +432,7 @@ export default class Tab extends TypedEventEmitter<ITabEventParams> {
431432 return this . waitForDom ( jsPath , options ) ;
432433 }
433434
434- public waitForLoad ( status : ILocationStatus | 'READY' , options ?: IWaitForOptions ) : Promise < void > {
435+ public waitForLoad ( status : ILocationStatus , options ?: IWaitForOptions ) : Promise < void > {
435436 return this . locationTracker . waitFor ( status , options ) ;
436437 }
437438
0 commit comments