Yii2 Codeception单选按钮列表

Yii2 Codeception单选按钮列表,yii2,radiobuttonlist,codeception,Yii2,Radiobuttonlist,Codeception,我有一个单选按钮列表,格式是 <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" nam

我有一个单选按钮列表,格式是

<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>
它抛出了一个错误:

 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.

据我所知,它是在寻找一个选择标签,而不是单选按钮。如果这不是检查是否选择了收音机的正确方法,那么是什么?

您的选择器似乎格式不正确,因为您没有在HTML文件中使用
表单
标记。也许可以尝试xpath,比如:
//input[@type='radio']
canseeOptions IsSelected()
函数中,我只是没有将它粘贴到这里。如果我调用::amOnPage(),代码工作正常;两次,这很奇怪。
 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.