I’m trying to click to close a message from a website with selenium. However, when I put it to click, a message appears in the Visual Studio Code console saying that it was not possible to click on the element because it is not a clickable element.
sleep(5)
web.find_element(By.XPATH, '//*[@id="top-container"]/div[1]/div/i').click()
devtool element
error https://i.stack.imgur.com/sgzoE.png
if anyone knows any library that delete the element in devtool. why do i need to remove that message to appear another button to proceed with application
2
Answers
There are different ways to call an element. Let’s try the following:
Please let me know if works, either way we can see other options
If you look at the error message carefully, it doesn’t state that it’s not a clickable element. It states that the click was intercepted. In other words, Selenium tried to click on the X to close but another element, an
<h3>
, got in the way.It looks like your locator is fine. According to the error message, it looks like it’s finding the right element. I personally would change it to
because I think it’s more readable and less likely to click the wrong element.
I can’t see the page so I have no idea what h3 is getting in the way and if it’s possible to even remove it. So, if you can’t get around the h3, you will likely have to use JS to click the element.