lundi 11 novembre 2019

"Element click intercepted" Error while trying to click on CheckBox

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.




Aucun commentaire:

Enregistrer un commentaire