其他分享
首页 > 其他分享> > selenium异常:element click intercepted

selenium异常:element click intercepted

作者:互联网

最近项目上使用selenium 自动发送instagram消息,遇到一个异常:

Message: element click intercepted: Element <button class="sqdOP yWX7d y3zKF " type="button">...</button> is not clickable at point (434, 409). Other element would receive the click: <div class="rh7Wz">...</div>
(Session info: chrome=95.0.4638.54)

 

针对该异常有很多资料,尝试了下面的方法,可行:

将对click方法调用处:

self.__get_element__(self.selectors['send'], "xpath").click()

  

修改为调用JS代码:

elem = self.driver.find_element_by_xpath(self.selectors['send'])
self.driver.execute_script("arguments[0].click()", elem)

  

self.__get_element__(self.selectors['send'], "xpath").click()

标签:xpath,self,selenium,intercepted,element,send,selectors,click
来源: https://www.cnblogs.com/LeoGIS/p/15431391.html