Getting “Message: h is null”

后端 未结 2 1819
难免孤独
难免孤独 2021-01-23 04:49

I\'ve recently encountered something I\'ve never seen before while using selenium.

The code (quite simple and straightforward):

from seleniu         


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-23 05:16

    Looks like by the time the page loads it is executing this line of code and throwing an error message. try to wait till the page loads by using

    time.sleep(200)
    

    and keep this line of code under try block as:

    try:
        WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "table.data-list")))
    except:
        print("not found")
    

提交回复
热议问题