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()
上一篇:vue a标签使用@click


下一篇:Svelte 中的事件修饰符