1

I am having MUCH trouble with selenium, as I don't even understand how the xpath works. I'm trying to make a script which selects a random radio button out of the available buttons. Heres the source code for the part of the page i'm interested in:

<input class="answerListOption hideOther answerCommentRequired answerCommentRequired190620_0" type="radio" name="survey_answer[190620][]" value="686346" data-mustcomment="answerCommentRequired190620" />
        <span class="answerText">xBox</span>
    </label>
</li>
    <li class="answerRowBox_4">
    <label>
        <input class="answerListOptions answerlistradio" type="radio" name="survey_answer[190620][]" value="-3117" tabindex="-1"/>
        <span class="answerText">n/a</span>
    </label>
</li>
    <li class="e848aca52a896563b17cd1484b2e3805">
    <label>
        <input class="answerListOption hideOther answerCommentRequired answerCommentRequired190620_0" type="radio" name="survey_answer[190620][]" value="686347" data-mustcomment="answerCommentRequired190620" />
        <span class="answerText">PS4</span>
    </label>
</li>
    <li class="bae58c269d9264734bf527ceb86bcb86">
    <label>
        <input class="answerListOption hideOther answerCommentRequired answerCommentRequired190620_0" type="radio" name="survey_answer[190620][]" value="686348" data-mustcomment="answerCommentRequired190620" />
        <span class="answerText">N/A</span>
    </label>
</li>
    <li class="answerRowBox_4">
    <input type="text" name="survey_answer[190620][-5630]" class="inputText charCounter" maxlength="150" data-maxlength="150" name="Input3" value="" tabindex="-1" />
</li>
</ul>

Its a few different radio buttons, with different awnsers. One is for xbox, other is for ps3. How would I select one of these radio buttons?

I'm trying to select one of them by the name "survey_awnser" as its the only thing that doesn't change.

4

0 回答 0