I am getting following error while trying to click on radio button using selenium Webdriver in python
ElementClickInterceptedException: Message: element click intercepted: Element
<input name="gender" required="" type="radio" id="gender-radio-1" class="custom-control-input" value="Male">
is not clickable at point (532, 370). Other element would receive the click: <label title="" for="gender-radio-1" class="custom-control-label">...</label>
(Session info: chrome=88.0.4324.182)
Below is the my code page url:https://demoqa.com/automation-practice-form
from selenium import webdriver
driver = webdriver.Chrome(executable_path = 'chromedriver')
driver.maximize_window()
driver.get('https://demoqa.com/automation-practice-form')
btn = driver.find_element_by_xpath('//input[@name = "gender"]')
driver.implicitly_wait(7)
btn.click()
Is there any way to work around this? I have tried multiple things but unable to perform the task.
Try forcing the click by executing javascript:
btn = driver.find_element_by_xpath('//input[@name = "gender"]')
driver.execute_script("arguments[0].click();", btn)
Separately, consider using WebDriverWait
instead of implicit waits.