Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor - ScriptTimeoutError: asynchronous script timeout: result was not received in 20 seconds

I'm new to Protractor and I am trying to run my script.

describe('Navigator homepage', function() {
it('should proceed to login', function() {
browser.get('url');
})
it('Clicks the proceed button',function() {
const proceedButton = element(by.id('auth-login-page-button'));

proceedButton.click();
});
});

But whenever I run it the browser opens up and proceeds to the website and then waits for 20 sec and I get Error: ScriptTimeoutError: asynchronous script timeout: result was not received in 20 seconds. The element is clearly there and can be clicked, however not for the protractor. Am I doing something wrong? Config file looks like this:

// An example configuration file.
exports.config = {
  directConnect: true,

  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome'
  },

  // Framework to use. Jasmine is recommended.
  framework: 'jasmine',

  // Spec patterns are relative to the current working directory when
  // protractor is called.
  specs: ['login_spec.js'],

  allScriptsTimeout: 20000,
  getPageTimeout: 15000,
  framework: 'jasmine',
  jasmineNodeOpts: {
    isVerbose: false,
    showColors: true,
    includeStackTrace: false,
    defaultTimeoutInterval: 40000
  }
  };
like image 383
Mateusz Avatar asked Oct 02 '17 14:10

Mateusz


People also ask

How do I fix a script timeout error in protractor?

For this, you'll have to add allScriptsTimeout (timeout in ms) to the Protractor configuration file and this will reflect the change in timeout globally. You can also fix this by making a change in the web applications for Protractor testing.

What is script timeout in selenium?

setScriptTimeout(); This is used to set the amount of time the WebDriver must wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, then the script will be allowed to run indefinitely.


1 Answers

I had a similar issue, I solved it by turning on ignore sync

browser.ignoreSynchronization = true
like image 92
Beyar Avatar answered Oct 02 '22 14:10

Beyar