I am trying to click on an element but getting the error:
Element is not clickable at point (x,y.5)
because another element obscures it.
I have already tried moving to that element first and then clicking and also changing the co-ordinates by minimizing the window and then clicking, but both methods failed. The possible duplicate question has answers which I have already tried and none of them worked for me.
Also, the same code is working on a different PC.
How to resolve it?
Advertisement
Answer
There is possibly one thing you can do. It is very crude though, I’ll admit it straight away.
You can simulate a click on the element directly preceding the element in need, and then simulate a key press [TAB] and [ENTER].
Actually, I’ve been seeing that error recently. I was using the usual .click()
command provided by bare selenium – like driver.find_element_by_xpath(xpath).click()
.
I’ve found that using ActionChains solved that problem.
Something like ActionChains(driver).move_to_element(element).click().perform()
worked for me.
You will need:
from selenium.webdriver.common.action_chains import ActionChains