I am receiving several errors and exception errors. I would like to run a series of functions that call several elements that i have scraped. The function runs fine on its own, it only runs into these errors when I also call on other functions.
Ive swapped around the order in which the function is called and the issue seems to lie when I call the PhoneCost function. If I leave the PhoneCost function to be the last one called all other lists will be called successful and PhoneCost will fail. All functions being called are lists. PhoneCost function calls a list of urls. If i run it independently without other functions being called there is no issue.
as for the things being printed, those are global variables which the functions help fill.
def PhoneCost(): driver.get("https://shop.freedommobile.ca/devices") # extract the names of the phones # 10 second wait wait.until(EC.presence_of_all_elements_located((By.XPATH, "//div[starts-with(@class,'deviceListItem')]/a"))) phonePlanLinksRaw = driver.find_elements_by_xpath("//div[starts-with(@class,'deviceListItem')]/a") for element in phonePlanLinksRaw: phonePlanLinks.append(str(element.get_attribute('href'))) phonePlanLinks.pop() # removes bring your own phone #prints all links numLink = 1 for element in range(len(phonePlanLinks)): print("phone " + str(numLink) + " : " + phonePlanLinks[element]) numLink += 1 driver.quit() PhoneCost() phone_models() PlanNames() print(phonePlanLinks) print(phone_full_name_list) print(_phonePlansList)
i expect the function to be called after the ones before it without any errors - producing me a list of links after producing a list of phone models and plan names.