Python Selenium-元素未附加到页面文档(在Chrome中下载csv文件)

Python Selenium-元素未附加到页面文档(在Chrome中下载csv文件),python,selenium,staleelementreferenceexception,Python,Selenium,Staleelementreferenceexception,我正在自动完成登录和下载数据的过程。在我的最后一步:单击“导出”,然后下载.csv文件。 我面对着错误: selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document (Session info: chrome=86.0.4240.111) 我试了很多方法如下,但我无法修复它。 ''

我正在自动完成登录和下载数据的过程。在我的最后一步:单击“导出”,然后下载.csv文件。 我面对着错误:

selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document (Session info: chrome=86.0.4240.111)
我试了很多方法如下,但我无法修复它。 '''

特定HTML元素:

<a onclick="return onGridExport(this);" id="ctl00_ctl39_g_c2f29a2f_3d77_43a2_b3ae_ad4098b04506_GridExport" tabindex="43" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ctl39$g_c2f29a2f_3d77_43a2_b3ae_ad4098b04506$GridExport&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))">Export</a>


可能页面尚未完全加载,因此元素尚未出现。尝试添加睡眠功能,然后点击5秒。谢谢!它解决了问题
<a onclick="return onGridExport(this);" id="ctl00_ctl39_g_c2f29a2f_3d77_43a2_b3ae_ad4098b04506_GridExport" tabindex="43" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ctl39$g_c2f29a2f_3d77_43a2_b3ae_ad4098b04506$GridExport&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))">Export</a>