selecting element in python selenium

后端 未结 4 1003
遇见更好的自我
遇见更好的自我 2021-01-23 21:27

I\'m trying to log onto a webpage with python selenium. I\'ve found an element and it is enabled, but when I try to send_keys() to it I get an error. The main thing (I think)

4条回答
  •  佛祖请我去吃肉
    2021-01-23 21:37

    You can use explicit waits:

    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    
    element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.CLASSNAME, "inputUsername"))
    )
    
    ...
    

提交回复
热议问题