How to select a radio button with Selenium and Python

I am trying to select the "Hitter" radio button. Can anyone please help? I've tried many different things but keep getting "Message: element not visible".

Thank!

enter image description here

+3


source to share


1 answer


There are several ways to find a radio input

, used here find_element_by_id()

:

radio = driver.find_element_by_id("ContentPlaceHolder1_HitterRadioButton")
radio.click()

      



Or, if you have problems with this approach, you can simulate the click through javascript:

radio = driver.find_element_by_id("ContentPlaceHolder1_HitterRadioButton")
driver.execute_script("arguments[0].click();", radio)

      

+5


source







All Articles