0

I'm experimenting with selenium on python 3.6 a bit and I'm trying to figure out how to wait for the page to load if I'm not using get()

    search_button = driver.find_element_by_id("search-icon-legacy")
    search_button.click()
    videos = driver.find_elements_by_tag_name("ytd-video-renderer")

I'm trying to search in Youtube and get all the videos of the search but sometimes videos is empty and sometimes it isn't

Yonathanb
  • 57
  • 10
  • 1
    https://stackoverflow.com/questions/26566799/how-to-wait-until-the-page-is-loaded-with-selenium-for-python – Goralight Nov 24 '17 at 08:57

1 Answers1

0

Speaking straight, you don't have to explicitly wait for Page Load. Once the Page Loading gets completed, the client i.e. Web Browser will send document.readyState == "complete" to Selenium and only then Selenium proceeds to execute the next line of code.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • As I said I'm not Using get() – Yonathanb Nov 24 '17 at 12:41
  • @DebanjanB I guess... with get() guy is going to navigate to login page first. So that is fine where get() will return once page is loaded. But on login page, when we hit login button, it is a click operation which will return immediately and we have to wait explicitly for page to be loaded – Dcode May 21 '18 at 09:26
  • @Dcode You are right, I missed to read the `click()` event initially. – undetected Selenium May 21 '18 at 09:35