I have a python selenium code that upload a local video and click the button, the button can be clicked when video successfully uploaded so I try with EC.element_to_be_clickable and EC.visibility_of_element_located and when the button is clickable print a simple message, but always I got the message before video upload complete.
this is my code :
file_uploader = driver.find_element_by_xpath('xpath_input')
file_uploader.send_keys(myvideo_file)
while True:
try:
WebDriverWait(driver, 1000).until(EC.element_to_be_clickable((By.XPATH, 'button_xpath')))
WebDriverWait(driver, 1000).until(EC.visibility_of_element_located((By.XPATH, 'button_xpath')))
break
except:
pass
print("Button ready to be clicked!")
button_xpathXPath locator is unique?try-excepthere? The timeout period is long enough. It should work without it.