I'm trying automate navigation of my account on a website. Because Selenium doesn't store my cookies across sessions, I have to accept the terms of service via a pop up every time. This would be fine, except Selenium is incapable of waiting.
# wait 1 minute
wait = WebDriverWait(driver, 60)
# wait for TOS to appear
wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="tos_agree"]')))
# accept TOS
elem = driver.find_element_by_xpath('//*[@id="tos_agree"]')
elem.click()
elem = driver.find_element_by_xpath('//*[@id="accept_tos"]')
elem.click()
# wait for login window to appear (b/c TOS needs to fade)
wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="login-dropdown"]')))
# login
elem = driver.find_element_by_xpath('//*[@id="login-dropdown"]')
elem.click()
The first wait seems to work, but then I get this message.
Message: Element <a id="login-dropdown" class="dropdown-toggle" href="/login"> is not clickable at point (1228.0749740600586,18.5) because another element <h2 class="heading"> obscures it
The stack trace indicates that the error is caused by the last elem.click(). I can also confirm that my program isn't waiting a full minute before crashing.
What's going on and how do I fix it?