WebDriverWait(driver,15).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='usernameInput-input']"))).send_keys("username")
time.sleep(random.uniform(3,5))
WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='password-input']"))).send_keys("password")
time.sleep(random.uniform(3,5))
WebDriverWait(driver,8).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='signIn']/span"))).click()
time.sleep(random.uniform(8,10))
WebDriverWait(driver,12).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='question']"))).text
I have this code written where it will automate login process and to help with the website not detecting automation I included random sleep time in between. The problem I am currently running into is that sometimes the code will jump from
WebDriverWait(driver,15).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='usernameInput']"))).send_keys("username")
to
WebDriverWait(driver,12).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='question']"))).text
which shouldn't happen as to get to this element you would first have to click the sign in that will move you onto the next page which has it so python will throw the error TimeoutException
Is there something wrong with my code or should I be using a different kind of Expected Conditions?