Selenium WebDriverWait,但仍“无法在点处单击元素". [英] Selenium WebDriverWait but still "Element is not clickable at point"
本文介绍了Selenium WebDriverWait,但仍“无法在点处单击元素".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码(br是webdriver,一切都可以导入).
I have the following code (br is the webdriver and everything is imported fine).
前3行工作正常,但是link1.click()仍然给我一个错误:
The first 3 lines work fine but the link1.click() still gives me an error:
link = WebDriverWait(br, 30).until(EC.element_to_be_clickable((By.ID, "buttonNew Project")))
link.click()
link1 = WebDriverWait(br, 30).until(EC.element_to_be_clickable((By.ID, "MP")))
link1.click()
即使它应该等到它可点击,我仍然会收到错误消息:
And even though it should have waited until its clickable, I still get the the error:
WebDriverException: unknown error: Element is not clickable at point (543, 170). Other element would receive the click: <div id="screenBlocker" style="width: 1920px; height: 979px; display: block; background-position: 940px 420px;"></div>
(Session info: chrome=49.0.2623.108)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64)(543, 170)
推荐答案
其他元素将获得点击:
<div id="screenBlocker" st...
screenBlocker
听起来确实像是屏幕阻止程序.您需要关闭页面顶部的弹出窗口/叠加层,使其不可见.
screenBlocker
does sound like a, well, Screen Blocker. You have a popup/overlay on top of the page which you need to close, make invisible.
如果没有可见的关闭"按钮,请通过以下方式使其不可见:
If there is no visible "close" button, just make it invisible this way:
blocker = driver.find_element_by_id("screenBlocker")
driver.execute_script("arguments[0].style = {display: 'none'};", blocker)
这篇关于Selenium WebDriverWait,但仍“无法在点处单击元素".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文