0

This time I'm having an issue clicking on a custom radio button on this: https://www.nebraska.gov/LISSearch/search.cgi

When I click the radio button (in this case the radio button with id = radio1), I get an exception,

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (153, 449). Other element would receive the click: (Session info: chrome=80.0.3987.163)

I've tried clicking on it using both the xpath, and the id, both giving the same error. I understand what the error is--it's not clickable. I was wonder how I could get around this is actually click on the radio button. I've also included an image of the radio button set down bellow.enter image description here

1 Answer 1

1

To handle element intercepted exception uoi can use below code:

    wait = WebDriverWait(driver, 10)
    radioButton=wait.until(EC.element_to_be_clickable((By.ID, "radio1")))
    ActionChains(driver).move_to_element(radioButton).click().perform()

or

    wait = WebDriverWait(driver, 10)
    radioButton=wait.until(EC.element_to_be_clickable((By.ID, "radio1")))
    driver.execute_script("arguments[0].click();", radioButton)

Note: Add belor libraries :

from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as Wait
from selenium.webdriver.common.action_chains import ActionChains
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that worked! So, was what you did there a javascript thing? @dipak Bachhav
sometimes element not clicked by selenium webdriver in that case you can use java script to click on to the element. The idea behind webbdriver click is actual user action but with javascript you can use javascript to click on to the element. This approach misses the idea of user interaction

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.