Selenium + Python + Unittest:Error message when executing Test "Other element would receive the click" Selenium + Python + Unittest:Error message when executing Test "Other element would receive the click" selenium selenium

Selenium + Python + Unittest:Error message when executing Test "Other element would receive the click"


One common instance for this error is when the element is not visible on the page, as in you might, for example, need to scroll to reach that element.If that's the case ActionChains should do the trick:

from selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.action_chains import ActionChainsWebDriverWait(driver, 20).until(EC.presence_of_element_located((By.ID, "slick-slide-control01")))ActionChains(driver).move_to_element(driver.find_element_by_id("slick-slide-control01")).click().perform()


It is also worth considering other scripts that might inject elements on the main page. Given the nature of the error, this look rather like one of those GDPR compliancy plugins that would force the alert on user. The best option is to dismiss it like Aayush mentioned and then go on with your script.


Bypass this by using javascript to carry out the click:

browser.execute_script(document.getElementById("slick-slide-control01").click())