docparse-scraper-nst
Version:
Node Zombie based scraper to scrape bills from the NStar (supplier code "NST)" website
19 lines (18 loc) • 531 B
JavaScript
var inspect = require('eyespect').inspector();
module.exports = function(bro) {
var selectedOptions = bro.querySelectorAll('select[name=accountNumber] option:selected');
if (selectedOptions.length === 0) {
inspect('no accounts selected');
return null;
}
if (selectedOptions.length > 1) {
inspect('more than 1 accounts selected');
return null;
}
var option = selectedOptions[0];
var output = {
accountNumber: option.getAttribute('value'),
accountName: option.innerHTML
};
return output;
};