I would like to select a give dropbox box on MoneyGeek, however, I can not use the Select() method.
def scrape_mg_insurance_info():
start_url = "https://www.moneygeek.com/insurance/auto/car-insurance-estimate-calculator/"
driver.get(start_url)
# Set state
css_path_dropbox = ".state > div:nth-child(2)"
#WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, css_path_dropbox))).click()
#css_path_select = ".state > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1)"
#WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, css_path_select))).click()
# XPath try
xpath_dropdown = "/html/body/div/div[1]/div/main/div[2]/div/div[2]/div[1]/div[2]/div[1]/div/div/div[1]"
driver.find_elements(By.XPATH, xpath_dropdown)[0].click()
xpath_select = "//div[contains@class, 'css-1wqdenc')]"
driver.find_elements(By.XPATH, xpath_select)[0].click()
My first implementation used the WebDriverWait() method. Using CSS Selector path it clicks on the dropdown successfully, but cannot select the proper option.
My second implementation uses the WebDriver(), this time I tried to use absolute XPaths. While I can select the dropbox menu, I cannot select the proper option.