python + web自动化,点击不生效,提示“selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (117, 674)”

前言:

在做web自动化时,遇到一个缩放了浏览器比例的操作,从100%缩小到80%,再进行点击的时候,弹出报错信息,无法点击

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (117, 674)
  (Session info: chrome=76.0.3809.132)

 

debug一下代码,发现可以根据元素属性,查找的到,不过就是点击不了

百度一下原因,说是元素相互覆盖,点击的位置被覆盖了,导致不能进行点击

解决方案:

第一种方式:采用js注入,执行click

element_loc = self.get_element(loc=loc, time=times)
self.driver.execute_script("arguments[0].click();", element_loc)

第二种方式:还有其他方式,比如ActionChains

第三种,采用回车替换点击

参考文章:https://blog.csdn.net/Makasa/article/details/113917649

https://blog.csdn.net/weixin_44321116/article/details/105118565

原文地址:https://www.cnblogs.com/cuitang/p/15060269.html