I am trying to open up several URL's (because they contain data I want to append to a list). I have a logic saying "if amount in icl_dollar_amount_l"
then run the rest of the code. However, I want the script to only run the rest of the code on that specific amount in the variable "amount"
.
Example:
selenium opens up X amount of links and sees ['144,827.95', '5,199,024.87', '130,710.67']
in icl_dollar_amount_l
but i want it to skip '144,827.95'
, '5,199,024.87'
and only get the information for '130,710.67'
which is in the 'amount'
variable already.
Actual results:
Its getting webscaping information for amount '144,827.95'
only and not even going to '5,199,024.87'
, '130,710.67'
. I only want it getting webscaping information for '130,710.67'
because my amount variable has this as the only amount.
print(icl_dollar_amount_l)
['144,827.95', '5,199,024.87', '130,710.67']
print(amount)
'130,710.67'
file2.py
def scrapeBOAWebsite(url,fcg_subject_l, gp_subject_l):
from ICL_Awk_Checker import rps_amount_l2
icl_dollar_amount_l = []
amount_ack_missing_l = []
file_total_l = []
body_l = []
for link in url:
print(link)
browser = webdriver.Chrome(options=options,
executable_path=r'\TESTuser$TESTDocumentsdriverchromedriver.exe')
# if 'P2 Cust ID 908554 File' in fcg_subject:
browser.get(link)
username = browser.find_element_by_name("dialog:username").get_attribute('value')
submit = browser.find_element_by_xpath("//*[@id='dialog:continueButton']").click()
body = browser.find_element_by_xpath("//*[contains(text(), 'Total:')]").text
body_l.append(body)
icl_dollar_amount = re.findall('(?:[£$€]{1}[,d]+.?d*)', body)[0].split('$', 1)[1]
icl_dollar_amount_l.append(icl_dollar_amount)
if not missing_amount:
logging.info("List is empty")
print("List is empty")
count = 0
for amount in missing_amount:
if amount in icl_dollar_amount_l:
body = body_l[count]
get_file_total = re.findall('(?:[£$€]{1}[,d]+.?d*)', body)[0].split('$', 1)[1]
file_total_l.append(get_file_total)
return icl_dollar_amount_l, file_date_l, company_id_l, client_id_l, customer_name_l, file_name_l, file_total_l,
item_count_l, file_status_l, amount_ack_missing_l