python selenium wait for page to load

后端 未结 1 972
离开以前
离开以前 2021-01-12 08:05

I\'ve written a script that gets data from a page, but sometimes the page takes time to load and so when it pull the html into a soup object sometimes It pulls nothing as th

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 08:34

    I think you should use presence_of_element_located like this:

    element = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, "myDynamicElement"))
        )
    

    as described in the manual.

    0 讨论(0)
提交回复
热议问题