yuna_0208 2019-03-27 17:40 采纳率: 0%
浏览 5126

selenium.common.exceptions.ElementClickInterceptedException解决办法

目标是定位提交元素,并点击,定位元素时,写的Xpath,可以精确指向元素,但无法定位
图片说明

1、原本的代码是
driver.find_element_by_xpath("html/body/div[12]/div[2]/div[1]/div[1]/div[3]/div[1]/button[2]/span").click()

报错信息如下:
File "D:\Program Files\python\lib\site-packages\selenium-3.13.0-py3.7.egg\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "D:\Program Files\python\lib\site-packages\selenium-3.13.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "D:\Program Files\python\lib\site-packages\selenium-3.13.0-py3.7.egg\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: Element is not clickable at point (1174,526) because another element obscures it

改成如下代码后即可定位并点击成功:
tijiao=driver.find_element_by_xpath("html/body/div[12]/div[2]/div[1]/div[1]/div[3]/div[1]/button[2]/span")
driver.execute_script("arguments[0].click();",tijiao)

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-09 18:29
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示