[Solved] Selenium Error: ElementClickInterceptedException

The error message is as follows:

The general meaning is that the current element is not clickable, but it does exist on the page, and it may be overwritten by loading
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button data-v-3916f4c2="" type="button" class="el-button el-button--primary" style="width: 100% ; height: 50px; border-radius: 10px; margin-top: 20px;">...</button> is not clickable at point (688, 398). Other element would receive the click: <div data-v- 3916f4c2="" class="login-top">...</div>

Solution 1: Force to wait for a few more seconds
# Can be forced to wait
import time
time.sleep()
Solution 2: Call js directly through selenium
js = driver.find_element(By.CSS_SELECTOR, ‘xxx’)
driver.execute_script(“arguments[0].click();”, js)

Display waiting:
The visibility_of_element_located used here is different from presence_of_element_located
visibility_of_element_located: After the element is found, the width and height of the element must be greater than 0 to execute;
presence_of_element_located: Execute directly after the element is found, maybe the element is covered by a mask, or the loading mask will cause you to be unable to click
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
try:
element = WebDriverWait(driver, 5).until(ec.visibility_of_element_located(loc))
except TimeoutException:
element.click()

Similar Posts: