I think I am in over my head! I am trying to learn python and I started with web scraping and have got to a non-passable point. I am getting InvalidSessionIdException and StaleElementReferenceException errors. I have tried explicit and implicit waits for the Invalid Session Id errors and tried expected conditions for the stale errors. I have tried several different things to no avail. If someone could help me that would be nice and sorry for the code I am only three days into learning python with a little prior experience.

```
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException

all_tickers = ['A', 'AA', 'AAAU', 'AACG']

driver = webdriver.Chrome()
for i in range(0, 7661):
    page_num = ('&r=' + str(i * 20 + 1))
    url = 'website' + str(page_num)
    driver.get(url)
    tickers = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="screener-content"]/table/tbody/tr[4]/td/table/tbody//td[2]/a')))
    company = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="screener-content"]/table/tbody/tr[4]/td/table/tbody//td[3]/a')))
    price = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="screener-content"]/table/tbody/tr[4]/td/table/tbody//td[9]/a')))
    num_of_tickers = len(tickers)
    for i in range(num_of_tickers):
        print(tickers[i].text + " : " + company[i].text + " : " + price[i].text, '', end = '')
        driver.close()

        driver = webdriver.Chrome()
        for index in all_tickers:
            url = 'website' + index + '/cash-flow?p=' + index
            driver.get(url)
            FCF_TTM = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="Col1-1-Financials-Proxy"]/section/div[4]/div[1]/div[1]/div[2]/div[7]/div[2]/div[3]/div[1]/div[2]/span')))[0].text
            FCF_2019 = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="Col1-1-Financials-Proxy"]/section/div[4]/div[1]/div[1]/div[2]/div[7]/div[2]/div[3]/div[1]/div[3]/span')))[0].text
            FCF_2018 = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="Col1-1-Financials-Proxy"]/section/div[4]/div[1]/div[1]/div[2]/div[7]/div[2]/div[3]/div[1]/div[4]/span')))[0].text
            FCF_2017 = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="Col1-1-Financials-Proxy"]/section/div[4]/div[1]/div[1]/div[2]/div[7]/div[2]/div[3]/div[1]/div[5]/span')))[0].text
            FCF_2016 = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="Col1-1-Financials-Proxy"]/section/div[4]/div[1]/div[1]/div[2]/div[7]/div[2]/div[3]/div[1]/div[6]/span')))[0].text
            print(FCF_TTM,  FCF_2019, FCF_2018, FCF_2017, FCF_2016, '', end = '')
            driver.close()

            driver = webdriver.Chrome()
            for index in all_tickers:
                url = 'website' + index + '/key-statistics?p=' + index
                driver.get(url)
                shares_outstanding = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="Col1-0-KeyStatistics-Proxy"]/section/div[3]/div[2]/div/div[2]/div/div/table/tbody/tr[3]/td[2]')))[0].text
                print(shares_outstanding, '', end = '')
                driver.close()

driver = webdriver.Chrome()
url = 'website'
driver.get(url)
year_10_bond = WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="yfin-list"]/div[2]/div/div/table/tbody/tr[3]/td[3]')))[0].text
print(year_10_bond)
driver.close()
''' 

```