I'm writing a webscrabing program and need to bulk search on FedEx, to do this I normally concatenate all my tracking numbers with "\n" between them to stand as an equivalent as pasting text from an excel column
issue is when I enter my string into their search box, it enters the number concatenated as if without the delimiter, so the search box only sees 1 long tracking number rather than multiple (lie if pasted from excel) any idea on how I can get the string formatted, or sent to the search box correctly?
this is what it looks like when I paste 2 tracking numbers 12345 and abcdefg:
and here's what it should look like:
here is my code for sending the string to the search box:
def fedex_bulk(tn_list):
# you can mostly ignore until the end of this function, all this is setup for the driver #
# all relevant formatting is in the creating of variable search_str #
driver = start_uc()
loaded = False
size=3
tn_list = [tn_list[i:i+size] if i+size <= len(tn_list) else tn_list[i:len(tn_list)] for i in range(0,len(tn_list),size)]
tn_dict = []
for sublist in tn_list:
tries = 0
### concatenate all tracking numbers with "\n" delimiter
search_str = ''
for tn in sublist:
search_str+=tn+'\n'
### loop until numbers searched or tried 4 times
while not loaded:
try:
if tries==4:
break
tries+=1
### refresh until loaded
driver.get("https://www.fedex.com/en-us/tracking.html")
page_loaded = False
while not page_loaded:
try:
inputform = driver.find_element(By.XPATH, "//input[@class='form-input__element ng-pristine ng-invalid ng-touched']")
page_loaded = True
except:
driver.refresh()
sleep(5)
### search_str sent to search box, formatted incorrectly
inputform.send_keys(search_str)
sleep(1)
driver.find_element(By.XPATH, "//button[@type = 'submit']").click()
thankyou in advance!

