Skip to content

Instantly share code, notes, and snippets.

@altendky
Created August 23, 2018 20:57
Show Gist options
  • Save altendky/c19023d03eb6492001a6c98f28bab309 to your computer and use it in GitHub Desktop.
Save altendky/c19023d03eb6492001a6c98f28bab309 to your computer and use it in GitHub Desktop.
def main_function(list_goes_here, deal_status): #This is the main search function in selenium. It will search for items in the browser
all_windows = driver.window_handles #and put successes into one bin, missing into another, and FUBAR ones into a third
for item in list_goes_here: #Use on the segmented list of old invoices first, then work procedurally through all cases
print(item)
holder = hyphen_split(item)
print(holder)
TLO_Bill_Num=holder[0]
TLO_Case_Num=holder[2]
TLO_IP_ID=holder[3]
TLO_Bill_Amount=holder[1]
correct = basename(item)
#for lines 6-11, consider the form x,y,z = thing.split()
if Full_Deal True:
x = (
(2, TLO_Bill_Num),
(4, TLO_Case_Num),
(9, TLO_Bill_Amount),
(8, TLO_IP_ID),
(10, Keys.Enter),
)
for m, n in x:
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField{}".format(m))).send_keys(n)
Actions(driver).wait(10)
elif Without_IP True:
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField2"))).send_keys(TLO_Bill_Num)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField4"))).send_keys(TLO_Case_Num)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField9"))).send_keys(TLO_Bill_Amount)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField10"))).send_keys(Keys.ENTER)
Actions(driver).wait(10)
elif Without_Case True:
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField2"))).send_keys(TLO_Bill_Num)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField8"))).send_keys(TLO_IP_ID)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField9"))).send_keys(TLO_Bill_Amount)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField10"))).send_keys(Keys.ENTER)
Actions(driver).wait(10)
elif Without_Money True:
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField2"))).send_keys(TLO_Bill_Num)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField4"))).send_keys(TLO_Case_Num)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField8"))).send_keys(TLO_IP_ID)
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID, "txtFromField10"))).send_keys(Keys.ENTER)
Actions(driver).wait(10)
try:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment