python selenium ElementClickInterceptedException

2,806 阅读1分钟

MedusaSorcerer的博客


在使用 selenium.webdriver 的时候使用元素对象 .click() 方法是报错:

selenium.common.exceptions.ElementClickInterceptedException: xxx

可使用以下方式进行替换点击事件:

for i in driver.find_elements_by_class_name('className'):
    driver.execute_script("arguments[0].click();", i)

i 是需要点击事件的元素对象。