selenium之StaleElementReferenceException

StaleElementReferenceException: Message: The element reference of

is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed

元素引用已经失效;要么元素不再附加到DOM中,要么不在当前框架上下文中,要么文档已经刷新

原因:机子太慢或者网速的问题,甚至可能是机子内存不够。

解决思路:让他睡上几秒

from time import sleep
sleep(5)


版权声明:本文为luoxuexi2020原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。