SHARE
TWEET

Untitled

a guest Mar 21st, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getCost(element) {
  2.   return parseInt(element.textContent.replace('$', ''));
  3. }
  4.  
  5. function clickPage(age, income) {
  6.   let inputs = document.getElementsByTagName('input');
  7.   let header = document.getElementsByClassName('sectionHeader')[0];
  8.   let inbar;
  9.  
  10.   inputs.age.value = age;
  11.   inputs.income.value = income;
  12.  
  13.   document.getElementsByClassName('submit')[0].click();
  14.   document.getElementsByClassName('planItem')[0].click();
  15.  
  16.   inbar = document.getElementsByClassName('inbar');
  17.  
  18.   header.click();
  19.  
  20.   return {
  21.     gop: getCost(inbar[0]),
  22.     obama: getCost(inbar[1])
  23.   };
  24. }
  25.  
  26. function main() {
  27.   const container = [];
  28.   for (let age=18; age<=80; age++) {
  29.     for (let income = 10000; income<=100000; income+=1000) {
  30.       let cost = clickPage(age, income);
  31.       cost.age = age;
  32.       cost.income = income;
  33.       container.push(cost);
  34.     }
  35.   }
  36.   return container;
  37. }
  38.  
  39. main()
RAW Paste Data
Top