1

I can click all of the other checkboxes on the page. But when it comes to this one, it won't allow me to click on it

The HTML code for the checkbox is:

<input id="ContentPlaceHolder1_wucSignInStep2_chkTC" type="checkbox" name="ctl00$ContentPlaceHolder1$wucSignInStep2$chkTC">

My code for clicking the text box:

element = driver.find_element_by_xpath('//span[span/input[@name="checkbox checkbox-primary"]]').click()

I can provide the full code if required.

3
  • 1
    What error do you get? Commented May 21, 2018 at 21:02
  • eminent is not clickable at point (305, 587). Other element would receive the click Commented May 22, 2018 at 16:38
  • I have updated my answer to handle this issue. Please, check. Commented May 22, 2018 at 20:06

1 Answer 1

4

There is an id associated with your input field! You can use the id to find the element

element = driver.find_element_by_id('ContentPlaceHolder1_wucSignInStep2_chkTC').click()

That should do it.

If you are getting an element not visible error then you can try the following:

from selenium.webdriver.common.action_chains import ActionChains

element = driver.find_element_by_id("ContentPlaceHolder1_wucSignInStep2_chkTC")

actions = ActionChains(driver)
actions.move_to_element(element).perform()
driver.execute_script("arguments[0].click();", element)

The above code will make the element visible and also, put the mouse cursor over the checkbox.

Sign up to request clarification or add additional context in comments.

4 Comments

when u try that I get the error: element is not clickable at point (305, 587). Other element would receive the click
Please, try the updated code. Also, feel free to mark it as accepted if it helps you to solve the issue.
@Wasi I am getting ElementNotInteractableException
@Anonymous Try waiting a few seconds before initiating the click using time.sleep() or even better wait.until(EC.element_to_be_clickable(By.id, "id_of_the_element"))

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.