Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElementClickInterceptedException: element click intercepted: [duplicate]

I'm trying to submit one form on wordpress plugin using selenium + python. When I press publish button , it is giving an error.

ElementClickInterceptedException: element click intercepted: Element type="submit" name="publish" id="publish" class="button button-primary button-large" value="Publish"> is not clickable at point (728, 15). Other element would receive the click: ...

I have tried following solutions: Used action driver, but it didn't work. Used webdriverwait() function, it didn't work. Used Xpath, CSS selector, ID - It's giving same error in all three.

 `    browser.find_element_by_css_selector("""#save-post""").click()

    WebDriverWait(driver, 90).until(EC.element_to_be_clickable((By.ID, "save-post"))).click()
`

Note that when I run that specific line in python console, it is working. But while running the full script, it is showing error.

There are so many similar questions on portal but none of them worked. Kindly help me to solve this issue.

like image 822
Nirav says Avatar asked Jun 26 '19 19:06

Nirav says


People also ask

Why do we get element click intercepted exception?

ElementClickInterceptedException occurs when the target element that you want to click is overlaid by some other element in the web page. For example, when you have an element below the dropdown/ Submenu; then you might have faced this kind of error.

Is not clickable at point XY other element would receive the click?

WebDriverException - Element is not clickable at point (xx, xx). Other element would receive the click'. This happens when the element is loaded into the DOM, but the position is not fixed on the UI. There can be some other divs or images or ads that are not loaded completely.


1 Answers

Ok, the answer is in error message - "Other element would receive the click: ..." I had the same problem when I just started using selenium.

Couldn't figure out what's the problem. "Other element would receive the click: ..." means there is other element above(overlapping) your element(pop up window, page is grayed out or disabled while loading, Some JS running etc., so when Selenium trying to click on your element its actually clicking on that blocking element.

Selenium is running really fast and clicking before its become clickable, that's why u are not able to click on it - "when I run that specific line in python console, it is working" Try to click after time.sleep() 5-10 sec or run script with debug mode.

If this is the case then you can use wait or add condition before find your element to check that element that prevent from clicking on you element is not there then u click on your element.

like image 61
IPolnik Avatar answered Oct 19 '22 13:10

IPolnik