I have a button: when I click on it, it sends an ajax request and after, the javascript code adds the class "hide" to this button when it is finished.
How can I wait the end of ajax request ? After sending the click command, I think Selenium should detect when the "hide" class is added to the button but I don't know how.
Can you help me please ?
It doesn't work (I have a timeout):
driver.find_element(By.ID, "saveButton").click()
wait = WebDriverWait(driver, 20)
wait.until(driver.find_element_by_xpath("//button[@id='saveButton' and contains(@class, 'hide')]"))