The browser.sleep () protranslator fails

At the bottom, as you can see, it is assumed that browser.sleep will be executed if the client is XYZ, but it still fails.

If I put any console.log after the browser.sleep statement, this statement will be executed (I can see the instruction), but browser.sleep does not really wait, even if the sleep time I increase.

Why does the browser not work? How to make him wait if the client is XYZ?

if (testproperties.client == 'ABC'){ browser.ignoreSynchronization = false; browser.waitForAngular(); browser.ignoreSynchronization = true; } else if (testproperties.client == 'XYZ'){ browser.sleep('35000'); }; 
+10
source share
4 answers

Are you skipping the int type as a parameter? It looks like this is a string. Try

 browser.sleep(35000) 

Also check out why you might need such a huge browser dream? Maybe you want browser.wait() instead?

+11
source

Try the following answer.

 if (testproperties.client == 'ABC'){ browser.ignoreSynchronization = false; browser.driver.sleep(2000); browser.ignoreSynchronization = true; } else if (testproperties.client == 'XYZ'){ browser.driver.sleep(2000); }; 

Hope this helps. :)

+1
source

Try to resolve the promise.

 browser.sleep(35000).then( function(){ console.log("Waiting"); } ) 

Or update the protractor to the latest version

 npm install protractor@latest --save 
+1
source

set the wait in the browser and pass the parameter (time in ms).

 await browser.sleep(5000); 
0
source

All Articles