selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable with Selenium and Python

VRX picture VRX · Sep 1, 2019 · Viewed 19.2k times · Source

I am currently working on a project which fills a form automatically. And the next button appears when the form is filled, that's why it gives me an error.

I have tried:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//input[@type='button' and @class='button']")))
Next = driver.find_element_by_xpath("//input[@type='button' and @class='button']")
Next.click()

HTML:

<span class="btn">
    <input type="button" value="Next" class="button" payoneer="Button" data-controltovalidate="PersonalDetails" data-onfieldsvalidation="ToggleNextButton" data-onclick="UpdateServerWithCurrentSection();" id="PersonalDetailsButton">
     </input>
     <div class="clearfix"></div>
</span>

ERROR:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (203, 530). Other element would receive the click: ... (Session info: chrome=76.0.3809.132)

Answer

user12215068 picture user12215068 · Oct 14, 2019

If the path of the xpath is right, maybe you can try this method to solve this problem. Replace the old code with the following code:

button = driver.find_element_by_xpath("xpath")
driver.execute_script("arguments[0].click();", button)

I solved this problem before, but to be honestly, I don't know the reason.