Disable 30s timeout on file download.

123 views
Skip to first unread message

Jan Bednář

unread,
Jan 31, 2015, 8:09:13 PM1/31/15
to casp...@googlegroups.com
Hello, my casper.download() function is killed after 30s. I works well os smaller files, but larger are stopped and size is 0b. Please, how to change this behavior?

Thanks 

Rodrigo Carvalho

unread,
Feb 2, 2015, 12:30:21 PM2/2/15
to casp...@googlegroups.com
Hi,

You can change the behavior in your function uses waitFor() or
casper.options.waitTimeout = 1000;


waitFor()

Signature: waitFor(Function testFx[, Function then, Function onTimeout, Number timeout, Object details])

Waits until a function returns true to process any next step.

You can also set a callback on timeout using the onTimeout argument, and set the timeout using the timeout one, in milliseconds. The default timeout is set to 5000ms:

Example:

casper.waitFor(function check() {
    return this.evaluate(function() {
        return document.querySelectorAll('ul.your-list li').length > 2;
    });
}, function then() {    // step to execute when check() is ok
    this.captureSelector('yoursitelist.png', 'ul.your-list');
}, function timeout() { // step to execute if check has failed
    this.echo("I can't haz my screenshot.").exit();
}, 60000); <====== here one minute of timeout


Read the documentation bellow
waitFor

Eloi Tay

unread,
Mar 13, 2015, 1:32:52 AM3/13/15
to casp...@googlegroups.com
Hi Rodrigo
Is not .download unaffected by the waitTimeout? I check the source code, there does not seems to be any waiting that was being done. I am currently also facing this problem but I do not think it is 30seconds but I do get 0 byte files every now and then.
Reply all
Reply to author
Forward
0 new messages