【发布时间】:2017-02-11 08:41:27
【问题描述】:
我使用壁虎浏览器,我需要选择一个特定的列表框或组合框,但同一页面有多个列表框和组合框。我尝试以下方法,但它适用于所有人。而且没有id标签,只有名字标签。
GeckoElementCollection ListeBoxKomboBox = Tarayıcı.Document.GetElementsByTagName("option");
foreach (GeckoHtmlElement Element in ListeBoxKomboBox)
{
if (Element.GetAttribute("value") == "1")
{
Element.SetAttribute("selected", "selected");
}
if (Element.GetAttribute("value") == "2")
{
Element.SetAttribute("selected", "selected");
}
}
我不希望您在其他框中选择具有相同值的项目。壁虎可以使用this like 解决方案吗?
【问题讨论】: