Skip to content Skip to sidebar Skip to footer

Element Not Being Clicked Even Though It Is Found Using Selenium

I'm trying to click on an element (radio button) using Selenium (in Python), I can't disclose the URL because it's a private corporate intranet, but will share the relevants part o

Solution 1:

Great question. If you know that selenium found the element, you can use Javascript to click the element directly. The syntax is:

driver.execute_script("arguments[0].click();", element)

You can also do this, which works the same way:

automate.execute_script("arguments[0].click();", wait.until(EC.element_to_be_clickable((By.XPATH, 'Your xpath here'))))

Essentially you are having Selenium run a javascript click on the element you have found which bypasses Selenium. Let me know if this helps!

Solution 2:

I don't see any such issue with your code block either. Perhaps you can try out either of the following options:

  • Using ActionChains:

    ActionChains(driver).move_to_element(WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='gestionesPropias_Equipo' and @type='radio']")))).click().perform()
    
  • Using executeScript() method:

    driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='gestionesPropias_Equipo' and @type='radio']"))))
    

Post a Comment for "Element Not Being Clicked Even Though It Is Found Using Selenium"