【发布时间】:2016-03-15 19:11:02
【问题描述】:
我有一个
形式的单选按钮列表<div data-toggle="buttons" style="margin: 5px 0 20px">
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="0"> 0</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="1"> 1</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="2"> 2</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="3"> 3</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="4"> 4</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="5"> 5</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="6"> 6</label>
<label class="btn grey active"><input type="radio" name="ResponseForm[nps]" value="7" checked=""> 7</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="8"> 8</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="9"> 9</label>
<label class="btn grey"><input type="radio" name="ResponseForm[nps]" value="10"> 10</label>
</div>
当我尝试检查是否选择了收音机时
::canSeeOptionsIsSelected('form input[type=radio]', 1);
它正在抛出一个错误:
Step I can see option is selected "form input[type=radio]",1
Fail Element located either by name, CSS or XPath element with 'selected option' was not found.
据我了解,它正在寻找选择标签,而不是单选按钮。如果这不是检查是否选择了收音机的正确方法,那是什么?
【问题讨论】:
标签: yii2 radiobuttonlist codeception