I'm new to programming and am searching for the best way to pull PDFs of a series of water bills from a city website. I have been able to open the webpage and been able to open an account using an account numbers from an excel list, however, I am having trouble creating a loop to run through all accounts without rewriting code. I have some ideas, but I'm guessing that better suggestions exist. See below for the intro code:
import bs4, requests, openpyxl, os
os.chdir('C:\\Users\\jsmith.ABCINC\\Desktop')
addresses = openpyxl.load_workbook ('WaterBills.xlsx')
type (addresses)
sheet = addresses.get_sheet_by_name ('Sheet1')
cell = sheet ['A1']
cell.value
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://secure.phila.gov/WRB/WaterBill/Account/GetAccount.aspx')
elem = browser.find_element_by_css_selector('#MainContent_AcctNum')
elem.click()
elem.send_keys (cell.value)
elem = browser.find_element_by_css_selector('#MainContent_btnLookup')
elem.click()
Thanks for your assistance!