Selenium报错Element is not clickable at point (X,Y)

报错信息:

原本的代码:

driver.find_element(By.XPATH, "//button[@id='submit_button']").click()

报错:

selenium ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point

解决办法

另一个元素覆盖了您尝试单击的元素。您可以使用execute_script()来单击它。

element = driver.find_element_by_class_name('pagination-r')
driver.execute_script("arguments[0].click();", element)

例如:

element = driver.find_element(By.XPATH, "//button[@id='submit_button']")
driver.execute_script("arguments[0].click();", element)

参考地址:https://stackoverflow.com/questions/37879010/selenium-debugging-element-is-not-clickable-at-point-x-y

Leave a Comment