@@ -2380,7 +2380,23 @@ class Playwright extends Helper {
23802380    const  waitTimeout  =  sec  ? sec  *  1000  : this . options . waitForTimeout ; 
23812381    locator  =  new  Locator ( locator ,  'css' ) ; 
23822382    const  context  =  await  this . _getContext ( ) ; 
2383-     const  waiter  =  context . waitForSelector ( buildLocatorString ( locator ) ,  {  timeout : waitTimeout ,  state : 'visible'  } ) ; 
2383+     let  waiter ; 
2384+     let  count  =  0 ; 
2385+ 
2386+     // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented 
2387+     if  ( this . frame )  { 
2388+       do  { 
2389+         waiter  =  await  this . frame . locator ( buildLocatorString ( locator ) ) . first ( ) . isVisible ( ) ; 
2390+         await  this . wait ( 1 ) ; 
2391+         count  +=  1000 ; 
2392+         if  ( waiter )  break ; 
2393+       }  while  ( count  <=  waitTimeout ) ; 
2394+ 
2395+       if  ( ! waiter )  throw  new  Error ( `element (${ locator . toString ( ) } ${ waitTimeout  /  1000 }  ) ; 
2396+       return ; 
2397+     } 
2398+ 
2399+     waiter  =  context . waitForSelector ( buildLocatorString ( locator ) ,  {  timeout : waitTimeout ,  state : 'visible'  } ) ; 
23842400    return  waiter . catch ( ( err )  =>  { 
23852401      throw  new  Error ( `element (${ locator . toString ( ) } ${ waitTimeout  /  1000 } ${ err . message }  ) ; 
23862402    } ) ; 
@@ -2393,7 +2409,23 @@ class Playwright extends Helper {
23932409    const  waitTimeout  =  sec  ? sec  *  1000  : this . options . waitForTimeout ; 
23942410    locator  =  new  Locator ( locator ,  'css' ) ; 
23952411    const  context  =  await  this . _getContext ( ) ; 
2396-     const  waiter  =  context . waitForSelector ( buildLocatorString ( locator ) ,  {  timeout : waitTimeout ,  state : 'hidden'  } ) ; 
2412+     let  waiter ; 
2413+     let  count  =  0 ; 
2414+ 
2415+     // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented 
2416+     if  ( this . frame )  { 
2417+       do  { 
2418+         waiter  =  await  this . frame . locator ( buildLocatorString ( locator ) ) . first ( ) . isHidden ( ) ; 
2419+         await  this . wait ( 1 ) ; 
2420+         count  +=  1000 ; 
2421+         if  ( waiter )  break ; 
2422+       }  while  ( count  <=  waitTimeout ) ; 
2423+ 
2424+       if  ( ! waiter )  throw  new  Error ( `element (${ locator . toString ( ) } ${ waitTimeout  /  1000 }  ) ; 
2425+       return ; 
2426+     } 
2427+ 
2428+     waiter  =  context . waitForSelector ( buildLocatorString ( locator ) ,  {  timeout : waitTimeout ,  state : 'hidden'  } ) ; 
23972429    return  waiter . catch ( ( err )  =>  { 
23982430      throw  new  Error ( `element (${ locator . toString ( ) } ${ waitTimeout  /  1000 } ${ err . message }  ) ; 
23992431    } ) ; 
@@ -2406,6 +2438,23 @@ class Playwright extends Helper {
24062438    const  waitTimeout  =  sec  ? sec  *  1000  : this . options . waitForTimeout ; 
24072439    locator  =  new  Locator ( locator ,  'css' ) ; 
24082440    const  context  =  await  this . _getContext ( ) ; 
2441+ 
2442+     let  waiter ; 
2443+     let  count  =  0 ; 
2444+ 
2445+     // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented 
2446+     if  ( this . frame )  { 
2447+       do  { 
2448+         waiter  =  await  this . frame . locator ( buildLocatorString ( locator ) ) . first ( ) . isHidden ( ) ; 
2449+         await  this . wait ( 1 ) ; 
2450+         count  +=  1000 ; 
2451+         if  ( waiter )  break ; 
2452+       }  while  ( count  <=  waitTimeout ) ; 
2453+ 
2454+       if  ( ! waiter )  throw  new  Error ( `element (${ locator . toString ( ) } ${ waitTimeout  /  1000 }  ) ; 
2455+       return ; 
2456+     } 
2457+ 
24092458    return  context . waitForSelector ( buildLocatorString ( locator ) ,  {  timeout : waitTimeout ,  state : 'hidden'  } ) . catch ( ( err )  =>  { 
24102459      throw  new  Error ( `element (${ locator . toString ( ) } ${ waitTimeout  /  1000 } ${ err . message }  ) ; 
24112460    } ) ; 
@@ -2487,12 +2536,17 @@ class Playwright extends Helper {
24872536    }  else  { 
24882537      // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented 
24892538      if  ( this . frame )  { 
2490-         const  {  setTimeout }  =  require ( 'timers/promises' ) ; 
2491-         await  setTimeout ( waitTimeout ) ; 
2492-         waiter  =  await  this . frame . locator ( `:has-text('${ text }  ) . first ( ) . isVisible ( ) ; 
2539+         let  count  =  0 ; 
2540+         do  { 
2541+           waiter  =  await  this . frame . locator ( `:has-text('${ text }  ) . first ( ) . isVisible ( ) ; 
2542+           await  this . wait ( 1 ) ; 
2543+           count  +=  1000 ; 
2544+         }  while  ( count  <=  waitTimeout ) ; 
2545+ 
24932546        if  ( ! waiter )  throw  new  Error ( `Text "${ text } ${ waitTimeout  /  1000 }  ) ; 
24942547        return ; 
24952548      } 
2549+ 
24962550      waiter  =  contextObject . waitForFunction ( text  =>  document . body  &&  document . body . innerText . indexOf ( text )  >  - 1 ,  text ,  {  timeout : waitTimeout  } ) ; 
24972551    } 
24982552    return  waiter . catch ( ( err )  =>  { 
0 commit comments