LambdaTest Community

Find answers, support, and inspiration from other users

LambdaTest Community

What are the ways to toggle the waiting feature in Protractor?

Can anyone please suggest me some ways to toggle the waiting feature in Protractor.

Up Vote Down Vote 0 Votes
Posted 3 months ago


Whenever you want navigation or open a page in the browser that does not use Angular, we can disable this feature of waiting for timeout by passing the argument as false when calling the function i.e. browser.waitForAngularEnabled(false).


But it might happen that we can get the Asynchronous Script TimeOut Exception from the WaitForAngular method. In such a case the first important thing would be to check on the timeout of our webdriver for scripts that have been set to something around 5 seconds for heavy and slowly loading websites.

Below is the complete code that demonstrates the behavior of handling timeouts in protractor.

// setting required config parameters //
exports.config = {
 directConnect: true,
 // Desired Capabilities that are passed as an argument to the web driver instance.
 capabilities: {
 'browserName': 'chrome' // name of the browser used to test //
 // Flavor of the framework to be used for our test case //
 framework: 'jasmine',
 // The patterns which are relative to the current working directory when 
protractor methods are invoked //
 specs: ['test_timeout.js'],
// overriding default value of getPageTimeout parameter //
 getPageTimeout: 10000,
// overriding default value of allScriptsTimeout parameter //
 allScriptsTimeout: 10000,
 jasmineNodeOpts: {
// overriding default value of defaultTimeoutInterval parameter //
 defaultTimeoutInterval: 30000
 onPrepare: function () {


// import all the required modules from selenium web driver and protractor
import 'selenium-webdriver';
import { browser, element, by, ExpectedConditions, protractor} from 'protractor'
 // describing the test for the timeout demonstration //
 describe('Timeout Demonstration in Protractor', function() {
browser.ignoreSynchronization = true; // disable synchronization for non angular websites //
 // tests to handle timeouts in protractor //
 it('Tests to handle timeouts in protractor', function() {
	// launch the url in the browser // 
 browser.get( , 10000);
 // locate the element // 
 element(by.xpath(" // label/ span ")).getAttribute("innerTextValue").then(function(textValue){
 // the value saved is assigned to the value of the text box
Up Vote Down Vote 0 Votes
Posted 3 months ago
1 Answer
3 months ago