Python with Selenium “element is not attached to the page document”

前端 未结 2 817
难免孤独
难免孤独 2021-01-14 01:31

I have a python function that should click through all options of a product:

submit_button = driver.find_element_by_id(\'quantityactionbox\')

elementList =          


        
2条回答
  •  情深已故
    2021-01-14 02:29

    The easy way to overcome many of these types of errors is to just add some sort of delay:

    import time
    
    time.sleep(1) 
    

    DOM manipulation after an event is fired usually takes a bit of time so you're not really losing that much of performance.

提交回复
热议问题