In the below as you can see that the browser.sleep is supposed to be executed if the client is XYZ, but still it is not getting executed. If i put any console.log after the browser.sleep statement, that statement is getting executed (i can see the statement) but the browser.sleep is not really waiting even though how much the sleep time i increase.
Why is the browser.sleep is not working? How do i make it wait if the client XYZ?
if (testproperties.client == 'ABC'){
browser.ignoreSynchronization = false;
browser.waitForAngular();
browser.ignoreSynchronization = true;
}
else if (testproperties.client == 'XYZ'){
browser.sleep('35000');
};
@gamecheck80 remove single quotes in the
// use like this
browser.sleep(35000);
Really quick for clarification: browser.sleep returns a promise. Looking into this closely:
browser.sleep('35000') is an acceptable input.
Because browser.sleep returns a promise, it will only appear that it works if you wait for the promise to finish.
describe('browser', function() {
it('should sleep', function() {
browser.get('http://angularjs.org');
// does not work
// browser.sleep(10000);
// console.log('waited 10 seconds?');
// this does not work and "waited 10 seconds?" appears immediately after navigating
// after sleeping then print "waited 10 seconds"
browser.sleep(10000).then(function() {
console.log('waited 10 seconds');
});
});
});
Hopefully this helps. For more help, please ask your support questions on StackOverflow, Google Group discussion list, or Gitter. For more information please reference https://github.com/angular/protractor/blob/master/CONTRIBUTING.md#questions
Thank you!
browser.sleep(10000).then(function() {
console.log('waited 10 seconds');
});
Using this with Angular 6 and protractor version 5.4.1 does not work, at least that's what I'm seeing
Most helpful comment
@gamecheck80 remove single quotes in the