johntitus / node-horseman

Run PhantomJS from Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.download() throwing malformed uri error (via empty data uri - "data:")

jamiesonbates opened this issue · comments

I've been troubleshooting a download error for a while and could use any nuggets of information you can provide.

I am trying to download an excel file. We are calling .click() on a button to download, and then immediately calling .download(), but on occasion, download will throw an error from the data-uri-to-buffer package because the uri passed is 'data:', essentially empty. I have squashed the error, and download eventually writes 'data:' to the file using the provided path, as expected.

This seems to happen randomly. Theories: the site we are interacting with has a heavier load than at other times, causing download to miss the file in some way; we are utilizing cookies/sessions in a way that causes the site we are interacting with to not provide the file; the page loaded slowly, causing a timing issue.

Additional information: when multiple xls files are downloaded during same horseman process, they seem to be overwriting one another on occasion.