I'm writing a bot in Python - Selenium that needs to choose things in a drop-down Select menu. The website in question seems to be initializing it's select drop down items with only 1 value: 1. My wait command
wait.until(EC.visibility_of_element_located((By.TAG_NAME, "select")))
won't cut it for this, it will only see the initial option of 1.
So I tried to wait until a 2nd option appears under it's select
wait.until(lambda d: d.find_elements(By.CSS_SELECTOR, 'option:nth-child(2)'))
but that always times out. This confuses me because this code executes fine:
wait.until(lambda d: d.find_elements(By.CSS_SELECTOR, 'option:nth-child(1)'))
Why am I timing out? I can see selects with 10 options as soon as the page is loaded. I've also tried Expected Conditions looking for the value or text of 2:
wait.until(EC.text_to_be_present_in_element_value((By.TAG_NAME, "option"),'2'))
times out
wait.until(EC.text_to_be_present_in_element_value((By.TAG_NAME, "option"),'1'))
has no trouble finding an option element with a value of 1.
I've tried a lot of iterations on this. Am I not understanding how wait commands and expected conditions are supposed to work?