<div id="member_sel_div" style="">
<table class="dataTable" width="100%" cellspacing="0" cellpadding="0" border="0" summary="">
<tbody>
<tr class="heding">
<tr class="odd">
<td valign="top" width="4%">
<input id="mgrp_-1" class="reset" type="checkbox" onclick="showMembers(-1, 0)" value="-1" name="member_group_id[]" style="position: absolute; z-index: -1; visibility: hidden;"/>
<span class="jquery-checkbox jquery-checkbox-checked" style="-moz-user-select: none;">
<span class="mark jquery-checkbox-hover">
<img width="24" height="24" src="/purebenefits/dev/images/empty.png"/>
</span>
</span>
</td>
<td valign="top" style="padding-left:0;">NO GROUP</td>
</tr>
我正在处理一个测试用例,其中将出现多个复选框,单击每个复选框将调用函数 showMembers(checkbox value, 0)
在我的测试用例中,我首先计算了复选框的数量,然后使用循环我也可以单击每个复选框,但是在单击复选框时,它的 onclick 功能没有触发,这就是我无法继续的原因。我也使用了fireevent函数,但结果是一样的
我正在使用 selenium IDE,上面给出了该部分的 html 代码,下面给出了我为 selenium ide 编写的代码
<tr>
<td>assertTextPresent</td>
<td>New Quote</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>name=insurance_type_id</td>
<td>label=Group Life Assurance</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Policy Features </td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Bronze</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@id='product_list_div']/table[@class='priceTable']/tbody/tr/th[4]/label/input[@id='prodid_6']</td>
<td></td>
</tr>
<tr>
<td>storeXpathCount</td>
<td>//div[@id='member_sel_div']/table[@class='dataTable']/tbody/tr[@class='odd']/td/input[@type='checkbox']/</td>
<td>count</td>
</tr>
<tr>
<td>echo</td>
<td>${count}</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>alert("Number of Group : ${count}")</td>
<td></td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>j</td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>i</td>
</tr>
<tr>
<td>store</td>
<td>javascript{storedVars.count;}</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>storedVars.i<=${count}</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${i}</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${j}</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>${i}-${j}</td>
<td>k</td>
</tr>
<tr>
<td>storeEval</td>
<td>window.document.getElementsByName('member_group_id[]')[${k}].value</td>
<td>abc</td>
</tr>
<tr>
<td>echo</td>
<td>${abc}</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@id='member_sel_div']/table[@class='dataTable']/tbody/tr[@class='odd']/td/input[@value='${abc}']/</td>
<td></td>
</tr>
<tr>
<td>fireEvent</td>
<td>//div[@id='member_sel_div']/table[@class='dataTable']/tbody/tr[@class='odd']/td/input[@value='${abc}']</td>
<td>"click"</td>
</tr>
<tr>
<td>store</td>
<td>javascript{storedVars.i++;}</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>