我想使用 Watin 遍历下拉列表。HTML 如下所示:
<select name="ctl00$Header1$ddlPropertyList" onchange="javascript:setTimeout('__doPostBack(\'ctl00$Header1$ddlPropertyList\',\'\')', 0)" id="ctl00_Header1_ddlPropertyList" onmouseover="this.title=this.options[this.selectedIndex].title" style="width:325px;">
<option selected="selected" value="0185795046:R:GPC:Eligible:F" title="0185795046 - ">0185795046 - </option>
<option value="0325844068:R:GPC:Eligible:F" title="0325844068 - ">0325844068 - </option>
<option value="0374795034:R:GPC:Eligible:F" title="0374795034 - ">0374795034 - </option>
<option value="0510031035:C:GPC:Eligible:F" title="0510031035 - ">0510031035 - </option>
<option value="1424795158:R:GPC:InEligible:F" title="1424795158 - ">1424795158 - </option>
<option value="1550795037:R:GPC:Eligible:F" title="1550795037 - ">1550795037 - </option>
</select>
当您单击下拉列表中的一个选项时,它会加载一个不同的页面,我想依次加载每个选项。基本上,我正在尝试做这样的事情:
SelectList ddl = browser.SelectList(Find.ById("ctl00$Header1$ddlPropertyList"));
foreach (var item in ddl.AllContents)
{
ddl.Select(item);
}
但我很确定我的代码是错误的。