0

I'm trying to click on an element using Selenium in Python. When I run the code, I receive the following error message:

ElementClickInterceptedException: element click intercepted: Element ... is not clickable at point (946, 81).

Other element would receive the click:

I am trying to use WebDriverWait to do an explicit wait, but it doesn't seem to be working. I have tried:

a) waiting for my desired element to be clickable:

WebDriverWait(browser.driver, 10).until(
            EC.element_to_be_clickable((By.ID, "ShadowModeAnchor.adminShadowUser"))
            )

b) waiting for the element named in the error message above to go invisible:

WebDriverWait(browser.driver, 10).until(
            EC.invisibility_of_element_located((By.XPATH, "//div[@style='background-color: #000;  /*needs to be BELOW popup*//*z-index: 3;*/  filter: alpha(opacity=0); opacity:0.0; height: 720px; width: 100%;  position: absolute;  top: 0px; left: 0px; display: block; '"))
            )

In both cases, I get the same error message listed above. Can anyone point out what I'm doing wrong, and how to fix it? Thank you!

Amruta
  • 1,128
  • 1
  • 9
  • 19
user12865812
  • 87
  • 1
  • 2
  • 6
  • What is the website you are trying to use. – Arundeep Chohan Feb 27 '20 at 05:10
  • show url so we could see HTML. What element do you try to click ? Links and buttons are clickable but other element may not be clicked - and they may need javascript to click them. If other element hides element which you try to click (ie. pop up mesage) then it may not be clickable. – furas Feb 27 '20 at 05:18
  • @arundeepchohan Sharing the link would unfortunately not help, because it's a password protected site. – user12865812 Feb 27 '20 at 05:57
  • @furas To clarify, if I wait long enough, the element I want to click (ID="ShadowModeUser...") becomes clickable. It's just that when the page is loading, it is obscured by another element. I'm trying to figure out a way for the script to know when it can safely click on the element I want, without hardcoding a wait time. – user12865812 Feb 27 '20 at 05:59
  • as I know `WebDriverWait` tests it every 0.5s and it returns as soon as it is accessible - so use longer time. If it is not enough then put it in try/except to catch error and repeate it in loop - but it would be easier to use much longer time. – furas Feb 27 '20 at 06:09
  • @furas thank you. I’d prefer not to hard code a specific time, but I will try a try/except approach. – user12865812 Feb 27 '20 at 13:24

0 Answers0