inputFile = str(args.inputFile[0]) outputFile = str(args.outputFile[0]) companyId = str(args.company[0]) userId = str(args.userId[0]) password = str(args.password[0]) headless = str(args.headless[0]) spreadsheet = Spreadsheet(inputFile) # To begin, we load the form on the supplied URL. # This is just the starting point, so the URL will change as we navigate around. form = Form('https://www.e-oscar-web.net/EntryController?trigger=Login', headless) # First we need to log in. form.fill([ form.select(id='companyId', val=companyId), form.select(id='userId', val=userId), form.select(id='password', val=password), form.select(id='securityMsgAck1'), form.select(selector='.loginBtn') ]) #We need to get the correct AUD Panel with form.frame('topFrame'): form.fill([form.select(id='DFProcessAUDanch')]) # For each row in the input csv we need to start filling the AUD forms for row in spreadsheet.rows: row_dict = dict(zip(spreadsheet.header, row.cells)) #Once in we need to fill the AUD forms
from file_lib import Spreadsheet from lib import SleepElement, Form # We create a reference to our spreadsheet so that we can fill data from it and update it. spreadsheet = Spreadsheet('sample.csv') # To begin, we load the form on the supplied URL. # This is just the starting point, so the URL will change as we navigate around. form = Form('https://www.e-oscar-web.net/EntryController?trigger=Login') # First we need to log in. form.fill([ form.select(id='companyId', val='RegID'), form.select(id='userId', val='UserID'), form.select(id='password', val='password'), form.select(id='securityMsgAck1'), SleepElement( 3 ), # For demonstration purposes only. Fills in info and then waits 3 seconds. form.select(selector='.loginBtn') ]) with form.frame('topFrame'): form.fill([form.select(id='AUDButton')]) # Clicking the .loginBtn will cause the form to submit and we'll be navigated to a new page. # Now we want to submit the form a bunch of times. Let's use our spreadsheet. for row in spreadsheet.rows: # We can update the spreadsheet with data from the form. # Here, we are updating the AUD column of each row to be the text of the #aud element. row.set('AUD', form.select(id='aud').text)