检查具有特定值的单选按钮

时间:2017-08-30 06:50:25

标签: selenium selenium-chromedriver behat mink

我有这个HTML:

<div class="c_row caption single" style="height: 89px;">
<label>
    <span>Question</span>
</label>
<div class="c_box radio-block" style="height: 88px;">
    <label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="1" checked="">
    <span class="lb">1</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="2">
    <span class="lb">2</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="3">
    <span class="lb">3</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="4">
    <span class="lb">4</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="5">
    <span class="lb">5</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="6">
    <span class="lb">6</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="7">
    <span class="lb">7</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="8">
    <span class="lb">8</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="9">
    <span class="lb">9</span><i class="input-helper"></i></label><label style="width: 10%; font-size: initial; height: 88px;" class="radio">
    <input class="radio-button" type="radio" name="question_27" value="10">
    <span class="lb">10</span><i class="input-helper"></i></label>
</div>
<div class="c_box select-block hidden" style="height: 88px;">
        <select class="selectmenu" name="question_27" id="ui-id-2" style="display: none;">
            <option disabled="" selected="" value=""> -- </option>
            <option value="1" selected="">1</option>
            <option value="2">2</option>
            <option value="3">3</option><option value="4">4</option>
            <option value="5">5</option><option value="6">6</option>
            <option value="7">7</option><option value="8">8</option>
            <option value="9">9</option><option value="10">10</option>
        </select>   
</div>


我想检查单选按钮,但问题是仅适用于无线电的第一个值。例如,如果我写:

And I select "1" from "question_27"

工作正常,但如果我尝试了第二个值:

And I select "2" from "question_27"

不起作用。我得到这个值不存在的错误。

你能帮帮我吗? Thx提前和抱歉我的英语

0 个答案:

没有答案