Skip to content

Instantly share code, notes, and snippets.

@kingbin
Last active July 27, 2016 21:26
Show Gist options
  • Save kingbin/30070542b85d128a58c10ce21d36818e to your computer and use it in GitHub Desktop.
Save kingbin/30070542b85d128a58c10ce21d36818e to your computer and use it in GitHub Desktop.
index.js
#!/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