Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScriptTimeoutError: asynchronous script timeout: result was not received in 0 seconds #117

Closed
wakandan opened this issue Sep 27, 2013 · 10 comments

Comments

@wakandan
Copy link

I'm getting this error occasionally, making all previously-passed tests failed. I saw this code driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS); from

http://stackoverflow.com/questions/11646586/unable-to-execute-selenium-asynchronous-script

but I don't know how to run something like that from my protractor test. How should I proceed with this?

@juliemr
Copy link
Member

juliemr commented Sep 27, 2013

You can either call the setScriptTimout statement from a beforeEach block in your test, or from the onPrepare block in the configuration file.

@wakandan
Copy link
Author

should I update this in the document? This happens a lot to me

@wakandan
Copy link
Author

Was it just setScriptTimeout() or ptor.setScriptTimeout() in beforeEach block? I tried both but the same thing happened. I put onPrepare: function(){ setScriptTimeout(5000); } into my exports.config, doesn't work as well...

@wakandan
Copy link
Author

is this the way to go? ptor.manage().timeouts().setScriptTimeout(10000);?

@andresdominguez
Copy link
Contributor

I had the same problem. My application takes a long time to load and I was getting timouts. Just add this code to your Protractor configuration file. Make sure you are using the latest version (0.10.0).

  onPrepare: function() {
    // Override the timeout for webdriver.
    ptor.driver.manage().timeouts().setScriptTimeout(60000);
  },

@wakandan
Copy link
Author

wakandan commented Oct 1, 2013

yup it works for me. Thank you all. Is this issue is so common, can we put
it down somewhere for latter reference?

On Monday, 30 September 2013, Andres Dominguez wrote:

I had the same problem. My application takes a long time to load and I was
getting timouts. Just add this code to your Protractor configuration file.
Make sure you are using the latest version (0.10.0).

onPrepare: function() {
// Override the timeout for webdriver.
ptor.driver.manage().timeouts().setScriptTimeout(60000);
},


Reply to this email directly or view it on GitHubhttps://github.com//issues/117#issuecomment-25335765
.

@juliemr
Copy link
Member

juliemr commented Oct 1, 2013

Added more clarification to the docs with a729e35

@juliemr juliemr closed this as completed Oct 1, 2013
@pulkitsinghal
Copy link
Contributor

@juliemr - with latest versions of protractor, you may want to update the docs again by replacing ptor.driver with browser

onPrepare: function() {
    // Override the timeout for webdriver.
    browser.manage().timeouts().setScriptTimeout(60000);
  },

@collintob
Copy link

collintob commented Jun 17, 2017

@juliemr , I've placed my browser.driver.manage().timeouts().setScriptTimeout in my beforeEach, but the timeout is not respected in the test. Here's example code that counts down 15 seconds, with a supposed 10 second timeout. The test counts down all of the way through 15 seconds without stopping/timing out. Can you advise?

var baseFuncs = require("../../pages/ams.base.po.js");
describe('quick test - smoke 1', function () {
beforeEach(function () {
browser.driver.manage().timeouts().setScriptTimeout(10000);
baseFuncs.getBasePage("foo1");
});
it('foo - bar1', function () {
baseFuncs.countDown(15000);
});
afterEach(function () {
console.log("done with 1");
});
});

@harin10
Copy link

harin10 commented May 15, 2018

I am getting a similar error could you please help me out. I tried the above options but I still see the issue.

[18:00:34] E/plugins - ScriptTimeoutError: asynchronous script timeout: result was not received in 60 seconds
(Session info: chrome=66.0.3359.139)
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 6.1.7601 SP1 x86_64)
at Object.checkLegacyResponse (X:\projects\Protractor\COSTCO_APP\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (X:\projects\Protractor\COSTCO_APP\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (X:\projects\Protractor\COSTCO_APP\node_modules\selenium-webdriver\lib\http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.executeScript()
at Driver.schedule (X:\projects\Protractor\COSTCO_APP\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
at Driver.executeAsyncScript (X:\projects\Protractor\COSTCO_APP\node_modules\selenium-webdriver\lib\webdriver.js:891:17)
at run (X:\projects\Protractor\COSTCO_APP\node_modules\protractor\built\browser.js:59:33)
at ProtractorBrowser.to.(anonymous function) [as executeAsyncScript] (X:\projects\Protractor\COSTCO_APP\node_modules\protractor\built\browser.js:67:16)
at Object.waitForPromise (X:\projects\Protractor\COSTCO_APP\node_modules\protractor-xhr-only-plugin\index.js:60:10)
at resolver (X:\projects\Protractor\COSTCO_APP\node_modules\protractor\built\plugins.js:194:51)
at new ManagedPromise (X:\projects\Protractor\COSTCO_APP\node_modules\selenium-webdriver\lib\promise.js:1077:7)
at Plugins.safeCallPluginFun (X:\projects\Protractor\COSTCO_APP\node_modules\protractor\built\plugins.js:210:20)
at promises.pluginObjs.filter.map.pluginObj (X:\projects\Protractor\COSTCO_APP\node_modules\protractor\built\plugins.js:219:40)
at Array.map (native)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants