Created
July 26, 2016 19:31
-
-
Save boriscy/8795fb130e42f0f4834ed1b1fb1fe75f to your computer and use it in GitHub Desktop.
Download data for Permits and Plug for Ohio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create(); | |
var url = 'http://apps.ohiodnr.gov/oilgas/rbdmsreports/Downloads_PermitAndPlug.aspx'; | |
casper.userAgent("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"); | |
casper.start(url); | |
casper.then(function(arg) { | |
//this.capture('a.png', {top: 100, left: 100, width: 700, height: 500}); | |
this.fillSelectors('#aspnetForm', { | |
'#ctl00_ContentPlaceholder1_rdp_ApplicationIssuedStart_dateInput': '12/1/2014', | |
'#ctl00_ContentPlaceholder1_rdp_ApplicationIssuedEnd_dateInput': '12/1/2015' | |
}, false); | |
this.click('#ctl00_ContentPlaceholder1_btnSearch'); | |
console.log('submited'); | |
}) | |
.waitForSelector('.rgMasterTable', function() { | |
//this.capture('b.png', {top: 100, left: 100, width: 700, height: 700}); | |
console.log('result rgMasterTable'); | |
}) | |
.thenClick('#ctl00_ContentPlaceholder1_RG_Results_ctl00_ctl03_ctl01_b_export', function() { | |
console.log('clicked Download'); | |
}) | |
.then(function () { | |
// wait for 10 seconds | |
this.waitForResource(/\w+\.xls$/, function() { | |
console.log("Download", resource.url); | |
}, null, 10000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment