Wait until page is loaded with Selenium WebDriver for Python

后端 未结 12 853
借酒劲吻你
借酒劲吻你 2020-11-22 00:26

I want to scrape all the data of a page implemented by a infinite scroll. The following python code works.

for i in range(100):
    driver.execute_script(\"w         


        
12条回答
  •  醉话见心
    2020-11-22 00:50

    Here I did it using a rather simple form:

    from selenium import webdriver
    browser = webdriver.Firefox()
    browser.get("url")
    searchTxt=''
    while not searchTxt:
        try:    
          searchTxt=browser.find_element_by_name('NAME OF ELEMENT')
          searchTxt.send_keys("USERNAME")
        except:continue
    

提交回复
热议问题