I have one element with attribute "aria-busy" that changes from true to false when data is in searching and done. How can I use selenium Expected Conditions and Explicit Waits to wait a default time like 20 seconds, if 20 seconds reaches and the attribute is not changed from true to false. throw exceptions. I have following, but it does not really work
import selenium.webdriver.support.ui as ui
from selenium.webdriver.support import expected_conditions as EC
<div id="xxx" role="combobox" aria-busy="false" /div>
class Ele:
def __init__(self, driver, locator)
self.wait = ui.WebDriverWait(driver, timeout=20)
def waitEle(self):
try:
e = self.driver.find_element_by_xpath('//div[@id='xxxx']')
self.wait.until(EC.element_selection_state_to_be((e.get_attribute('aria-busy'), 'true')))
expect:
raise Exception('wait timeout')