I'm scraping a weird ASP-based site. I want to download an XML file. To get the download normally, I fill out a form, click "download", then a popup comes up and the file downloads automatically (in both chrome and firefox).
What seems to ultimately trigger the download is a GET request to an 'www.HOST.content/xmlfile.aspx' url which gets a 'content-disposition:attachment' with a filename 'xmldocumentIcareabout.xml'
While I can see this request/response using the developer console in chrome (on the popup page), I do not see these events in 'resource.requested' or 'resource.received' on the Casperjs side.
What I've tried so far:
- Explicit call to 'this.download('www.HOST.content/xmlfile.aspx')
- Post call using the form: 'this.download('www.HOST.content/form.aspx',downloadPath,'POST', postBody)' where 'postBody' has all the form information and the __EVENT_TARGET
- Trying to replicate the GET request with this.open('www.HOST.content/xmlfile.aspx')
What other approaches can be used so that I can catch an automatic download event from a popup window in Casperjs?