报错如下:
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
原因:页面还没加载完就去获取页面数据,所以获取不到
解决方法:加个time.sleep(3),等几秒后就可以正常使用xpath、selector之类的了
使用selenium用xpath获取页面元素遇到的bug以及解决办法
最新推荐文章于 2024-05-08 17:15:01 发布