Last active
July 27, 2016 21:26
-
-
Save kingbin/30070542b85d128a58c10ce21d36818e to your computer and use it in GitHub Desktop.
index.js
This file contains hidden or 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
#!/usr/bin/env node | |
try{ | |
var webdriverio = require('webdriverio'); | |
var options = { | |
desiredCapabilities: { browserName: 'phantomjs' }, | |
webStorageEnabled: true, | |
logLevel: 'verbose' | |
}; | |
var client = webdriverio.remote(options); | |
var year = new Date().getFullYear(); | |
var cb = [ | |
'#commodityYearCheckBoxList_'+(year+1).toString(), | |
'#commodityYearCheckBoxList_'+(year).toString() | |
]; | |
client | |
.init() | |
.setViewportSize({width:1124,height:850}, false) | |
.url('http://prodwebnlb.rma.usda.gov/apps/PriceDiscovery/GetPrices/ManyPrices') | |
.click( cb[0] ) | |
.click( cb[1] ) | |
.click('#UpdatePricesButton') | |
.click('#linkToCsv') | |
.getTitle().then(function(title) { | |
console.log('Title is: ' + title); | |
}) | |
.end(); | |
} | |
catch(err){ | |
console.assert(err.message); | |
console.log('No Worky'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment