1. 程式人生 > >Selenium: either the element is no longer attached to the DOM, it is not in the curren

Selenium: either the element is no longer attached to the DOM, it is not in the curren

either the element is no longer attached to the DOM, it is not in the curren

元素不再附加到DOM

解決方法
每次都重新尋找xpath,並且加上延時

while n < 30 :
    path = "/html/body[@class='m-index zy']"
    diyiti = dr.find_element_by_xpath(url).click()
    n = n + 1
    time.sleep(2)