Element is found but not clickable

112 Views Asked by At

I'm trying to find an element by it's id, click on it and download a file.

driver.get(url);
driver.implicitly_wait(60);
time.sleep(3)
element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "ContentPlaceHolder1_a1")))
href = element.get_attribute('href')
value = href.split('/')[-1]
print(value);
element.click(); # Error

Error element click intercepted: Element is not clickable at point (110, 1003)

I've tried Xpath, and CSS path too. All give the same error. If I check for the visibility then it times out. But I can manually see that the element is visible

element = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//a[contains(text(), 'text of the link')]")))

At last, I tried this code.

element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "ContentPlaceHolder1_a1")))
ActionChains(driver).move_to_element(element).click().perform()

But it gives error

selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: move target out of bounds
1

There are 1 best solutions below

0
KunduK On BEST ANSWER

While identified the element, page is still loading, may be the reason it is clicking on somewhere else.

Scroll down to the element and then wait for 1 to 2 seconds and then click.

It is working perfectly for me.

element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "ContentPlaceHolder1_a1")))
element.location_once_scrolled_into_view #scroll down to element
time.sleep(2) # wait for 2 seconds , 1 sec working as well
element.click()