3

I want to click on a check box after I load up a page, but I get the error message below:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <img class="checkboximage" src="/images/nav/ns_x.gif" alt=""> is not clickable at point (843, 7). Other element would receive the click: <a class="ns-help" onclick="nlPopupHelp('EDIT_TRAN_CUSTINVC');" tabindex="0" onkeypress="(event.keyCode == 13 || event.charCode == 32) &amp;&amp; nlPopupHelp('EDIT_TRAN_CUSTINVC');">...</a>

This is what I have right now: I've tried several other methods before this

collectionsbox = driver.find_element(By.CSS_SELECTOR,"#custbody_in_collections_fs_inp")
                driver.execute_script("arguments[0].scrollIntoView(true)", collectionsbox)

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//span[@id='custbody_in_collections_fs']//img[@class='checkboximage']"))).click()

collectionsbox.click() #USUALLY FAILS RIGHT HERE

savebutton = driver.find_element(By.XPATH,"//input[@id='btn_multibutton_submitter']")

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='btn_multibutton_submitter']"))).click()

driver.execute_script("arguments[0].scrollIntoView(true)", savebutton)
savebutton.click()
time.sleep(2)
driver.switch_to.alert.accept()

I've tried the EC method, waited several seconds, scroll down to view the element. I've even used Xpath, ID, and CSS.

<input onclick="setEventCancelBubble(event); this.isvalid=(nlapiValidateField(null,'custbody_in_collections')); if (this.isvalid) {setWindowChanged(window, true);nlapiFieldChanged(null,'custbody_in_collections');;} else if ( window.loadcomplete &amp;&amp; !document.page_is_resetting ) {setFormValue(this, !this.checked);}" aria-labelledby="custbody_in_collections_fs_lbl" onchange="NLCheckboxOnChange(this); " onkeypress="NLCheckboxOnKeyPress(event);  return true;" name="custbody_in_collections" id="custbody_in_collections_fs_inp" type="checkbox" value="T" class="checkbox" style="">
<input type="hidden" name="custbody_in_collections_send" style="">
<img class="checkboximage" src="/images/nav/ns_x.gif" alt="" style="">

All I need is click the checkbox and click save up top.

1
  • notice the "CancelBubble" code there? This page is relying on all other clicks to bubble up/down to the overlayed span... which creates a pop-up. Seems like you want to click the checkbox anyway, not the image. The only reason Selenium finds the image to be clickable is that span's onClick eventhandler. Commented Nov 11, 2019 at 22:37

2 Answers 2

4

Seems like another element on the DOM is unintentionally hiding the element you are trying to click. You can try executing Javascript for the click instead. This usually resolves the issue for me.

Instead of collectionsbox.click() #USUALLY FAILS RIGHT HERE, you can replace with:

driver.execute_script("arguments[0].click();", collectionsbox)
Sign up to request clarification or add additional context in comments.

Comments

2

To address element is not clickable at point (x, y) error. We can follow below approaches to resolve this issue

Solution

1. Action Class

WebElement element = driver.findElement(By.id("yourelement ID"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();

2. Element not getting clicked as it is not within Viewport

use JavascriptExecutor to get element within the Viewport:

checkBox=WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"yourelement Xpath")))
ActionChains(driver).move_to_element(checkBox).click(checkBox).perform()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.