Selenium Element ClickInterceptedException错误
我正在研究这个 weblote 基本上,我想从news
部分中捕获两个最新新闻,该部分位于桌子下方,并在某些JSON中存储该新闻,并在可能的情况下收集图片,但我无法访问新闻部分,因为它总是会增加错误说
selenium.common.exceptions.elementClickInterceptedException:消息:element< aid =“ ctl00_contentplaceholder1_companydetail1_lnknknewstab” href =“ href =”#divnews“> gt; is not clickable at point (307,786) because another element
这是我尝试过的代码的某些部分
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
stocks_data = ["AKPL","NICA"]
for stock_data in stocks_data:
self.driver.get(f'https://merolagani.com/CompanyDetail.aspx?symbol=
{stock_data.lower()}')
self.driver.find_element_by_xpath("//li[@id='navNews']"
"//a[@id='ctl00_ContentPlaceHolder1_CompanyDetail1_lnkNewsTab']").click()
I am working on this website
Basically I want to capture 2 latest news from News
section that is below the table and store that news in some json and collect picture if possible but I am not able to go to the news section as It always raise error saying
selenium.common.exceptions.ElementClickInterceptedException: Message: Element <a id="ctl00_ContentPlaceHolder1_CompanyDetail1_lnkNewsTab" href="#divNews"> is not clickable at point (307,786) because another element <iframe id="webpush-onsite" name="webpush-onsite"> obscures it
here is some part of code I tried tough
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
stocks_data = ["AKPL","NICA"]
for stock_data in stocks_data:
self.driver.get(f'https://merolagani.com/CompanyDetail.aspx?symbol=
{stock_data.lower()}')
self.driver.find_element_by_xpath("//li[@id='navNews']"
"//a[@id='ctl00_ContentPlaceHolder1_CompanyDetail1_lnkNewsTab']").click()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您真的需要单击它,无论普通用户都无法解决,因为正如错误所说,它的顶部有一个iframe ...
尝试以下内容:
将窗口大小设置为1920x1080左右,也许是元素重叠,因为Selenium会话中的屏幕太小
If you really need to click it regardless a normal user won't be able because as the error says, there's an IFrame on top of it...
Try the following:
Set the window size to 1920x1080 or so, maybe the elements overlap because the screen on Selenium's session is too small ????♂️
Worst case scenario, inject some Javascript code to do it forcefully: