Python 元素在点(1232413)处不可单击

Python 元素在点(1232413)处不可单击,python,selenium,Python,Selenium,我的代码基本上是登录到网站()并通过单击按钮(下载CSV)下载CSV文件。然而,我得到一个错误,上面写着: File "c:\Users\USERPC\Desktop\python\sesno_login.py", line 57, in <module> csv_file_button.click() File "C:\Users\USERPC\AppData\Local\Programs\Python\Python36-32\lib\site- packages\seleni

我的代码基本上是登录到网站()并通过单击按钮(下载CSV)下载CSV文件。然而,我得到一个错误,上面写着:

File "c:\Users\USERPC\Desktop\python\sesno_login.py", line 57, in <module>
csv_file_button.click()

File "C:\Users\USERPC\AppData\Local\Programs\Python\Python36-32\lib\site- 
packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)

File "C:\Users\USERPC\AppData\Local\Programs\Python\Python36-32\lib\site- 
packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)

File "C:\Users\USERPC\AppData\Local\Programs\Python\Python36-32\lib\site- 
packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)

File "C:\Users\USERPC\AppData\Local\Programs\Python\Python36-32\lib\site- 
packages\selenium\webdriver\remote\errorhandler.py", line 242, in 
check_response raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.WebDriverException: Message: unknown error: 
Element <tspan>...</tspan> is not clickable at point (1232, 413). Other 
element would receive the click: <div class="page-loading ng-scope" ng- 
if="showPreloader" style="">...</div>
有人能找出我为什么老是犯这种错误吗?另外,这是csv文件的网页HTML:

<g class="highcharts-button highcharts-contextbutton highcharts-button- 
normal" style="cursor:pointer;vertical-align:center;font-size:12;font- 
weight:500;" stroke-linecap="round" transform="translate(379,8)"> 
<title>Chart context menu</title><rect fill="rgba(0, 0, 0, 0.7)" class=" 
highcharts- button-box" x="0.5" y="0.5" width="100" height="32" rx="2" 
ry="2" stroke="none" stroke-width="1"></rect><text x="7" style="font- 
weight:normal;color:#fff;fill:#fff;" y="19"><tspan>Download CSV</tspan> 
</text></g>

图表上下文菜单下载CSV

有时候selenium webdriver找不到元素,所以最好使用javascript executor单击所需的按钮

例如:

js = (JavascriptExecutor) driver;
js.executeScript("$('#downloadcsv').click()");

查看错误消息时可能会出现重复。它告诉您问题是什么。问题是按钮位于图表中,很难找到它
其他元素将收到单击:…
我假设
DIV
显示“加载…”或类似的内容,因为类
页面加载
。尝试等待加载程序
DIV
可见然后不可见,然后尝试单击。这对我来说很有效,我刚刚添加了时间。登录后睡眠(5)
js = (JavascriptExecutor) driver;
js.executeScript("$('#downloadcsv').click()");