selenium点击click报错,如何解决

比如你使用selenium使用click操作

driver.find_element(By.CSS_SELECTOR,"#submit").click()

报了下面错误

出现如下异常:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <\button type="submit" id="submit" class="btn btn-wide btn-primary" data-loading="稍候...">...</button> is not clickable at point (518, 660). Other element would receive the click: <ul class="breadcrumb">...</ul>
(Session info: chrome=78.0.3904.108)

这时候我们怎么来解决呢
解决方法:
使用回车代替点击,使用send_keys操作回车按钮

driver.find_element(By.CSS_SELECTOR,"#submit").send_keys(Keys.ENTER)

只需要把.click()改为.send_keys(Keys.ENTER)即可

发布了147 篇原创文章 · 获赞 9 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/weixin_44049466/article/details/104938958