How can I get Selenium Web Driver to wait for an element to be accessible, not just present?

后端 未结 4 1229
不思量自难忘°
不思量自难忘° 2020-11-29 23:06

I am writing tests for a web application. Some commands pull up dialog boxes that have controls that are visible, but not available for a few moments. (They are greyed out,

4条回答
  •  青春惊慌失措
    2020-11-30 00:05

    I think something along these lines should work as well:

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions
    
    browser = webdriver.Firefox()
    wait = WebDriverWait(browser, 30)
    wait.until(expected_conditions.presence_of_element_located((By.XPATH, "//*[@id='createFolderCreateBrn' and not(@disabled)]")))
    

提交回复
热议问题