0

I'm trying to implement an explicit wait before giving a click on a checkbox:

WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.XPATH, "pay_type_list_item_id_salary"]")))

self.driver.find_element_by_xpath('//input[@id="pay_type_list_item_id_salary"]').click()

My problem is that my explicit wait keeps sending the error:

not clickable at point (663, 478). Other element would receive the click.

I'm trying to use different kind of explicit waits like visibility_of_element_located or invisibility_of_element_located (using an element from the previous step on my script), but no luck with those options.

If I add a time.sleep(1) between the 2 lines my scripts works but I know it's not the most efficient thing to use time.sleep.

The previous step before this one opens a calendar and I'm not sure if it tries to give the click when the calendar is closing and that's the reason to receive this error.

user964503
  • 91
  • 1
  • 13
  • I believe your problem doesn't have anything related to your `wait`. You problem is probably that the element you want to click is not in your viewport, so you have to scroll first. Please check [this question](https://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error) or [this tutorial](http://www.seleniumeasy.com/selenium-tutorials/element-is-not-clickable-at-point-selenium-webdriver-exception). Maybe it can help. – Tom Sep 27 '17 at 23:34
  • I was seeing few minutes ago that I'm not having this problem with Firefox , it's really strange that only happens with Chrome, will check the links you provided , thanks, – user964503 Sep 27 '17 at 23:40
  • Unfortunately sometimes different browsers have different behaviours. Good luck. – Tom Sep 27 '17 at 23:50
  • Share the URL so I can check it – iamsankalp89 Sep 28 '17 at 06:29
  • sorry, it's an internal web application – user964503 Sep 28 '17 at 16:35

1 Answers1

1

The error you are getting is indicating that another element is covering the element you are trying to click. If you look at the error message (you really should post the full error message in your question), it will tell you the HTML of the element that is in the way. That will give you a good idea of what element is blocking the click so you can find it and figure out what part of the page it is. Then you can wait for it to get out of the way. From your description, it sounds like you need to add a wait for the calendar to close.

JeffC
  • 22,180
  • 5
  • 32
  • 55
  • Yes, the calendar is the one blocking the click, that's the thing , even if I add a wait like the one I mentioned above: WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.XPATH, "pay_type_list_item_id_salary"]"))) or WebDriverWait(self.driver, 10).until(EC.invisibility_of_element_located((By.XPATH, "calendar table"]"))) , the second to wait until the calendar is closed but nothing works , this is only happening in Chrome , in Firefox works using any of the 2 explicit waits – user964503 Sep 28 '17 at 16:36