Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98814

Using Selenium in Python to click/select a radio button

$
0
0

I am trying to select from a list of 3 buttons, but can't find a way to select them. Below is the HTML I am working with.

<input name="pollQuestion" type="radio" value="SRF"> 
    <font face="arial,sans-serif" size="-1">ChoiceOne</font><br />
<input name="pollQuestion" type="radio" value="COM">
    <font face="arial,sans-serif" size="-1">ChoiceTwo</font><br />
<input name="pollQuestion" type="radio" value="MOT">
    <font face="arial,sans-serif" size="-1">ChoiceThree</font>

I can find it by using the following code:

for i in browser.find_elements_by_xpath("//*[@type='radio']"):
     print i.get_attribute("value")

This outputs: SRF,COM,MOT

But I would like to select ChoiceOne. (To click it) How do I do this?


Viewing all articles
Browse latest Browse all 98814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>