title: python selenium - selecting option from dropdown
body: <p>I am attempting to use the below code to use selenium (python) to select an option from a dropdown on a webpage.</p>
  
  <pre><code>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
  
  path_to_chromedriver = 'C:/Users/User_1/chromedriver/chromedriver'
  browser = webdriver.Chrome(executable_path = path_to_chromedriver)
  
  url = 'https://lifeinsurance.rac.com.au/rac/get-a-quote?productid=51'
  browser.get(url)
  
  wait = WebDriverWait(browser, 10)
  
  # residence listbox
  drop_down = browser.find_element_by_xpath('//*[@id="divApplicantDetails__1"]/div[8]/div/div[2]/span/span/span[1]')
  
  browser.execute_script('arguments[0].style.display="inline";', drop_down)
  wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="divApplicantDetails__1"]/div[8]/div/div[2]/span/span/span[1]')))
  
  wait.until(EC.element_to_be_clickable((By.XPATH, r'//*[@id="ddResidentialStatusId__1_listbox"]/li[1]'))).click()
  </code></pre>
  
  <p>There are occasions where it works (and an option from the dropdown is selected), but on other occasions an option from the dropdown is NOT selected (and no error raised either).</p>
  
  <p>I would appreciate any feedback on how to consistently select an option from the dropdown noted in the code provided.</p>