我想从下拉列表中选择“VxDev:InterAction 测试自动化列表”。代码如下
<select name="intEmailListId" id="intEmailListId" style="min-width: 210px" data-selected-list="8589934864" class="list_selector">
<option value="">** Please select a list **</option>
<option value="">
--
</option>
<option value="my-contacts">
My contacts
</option>
<option value="">
--
</option>
<option value="8589934952">
* 001 New List
</option>
<option value="8589934880">
VxDev: Hard Bounce List (QA team only)
</option>
<option value="8589934864" selected="">
VxDev: InterAction Test Automation List
</option>
我在 xpath 下面尝试过,它曾经可以工作,但现在无法正常工作
try
{
selectedList =
BrowserFactory.Driver.FindElement(
By.XPath(".//li[text()[contains(.,'" + listName + "')]]/input"));
}
catch (NoSuchElementException)
{
selectedList = BrowserFactory.Driver.FindElement(
//By.XPath(".//option[text()[contains(.,'" + listName + "')]]"));
By.XPath(".//option[starts-with(normalize-space(text()),'" + listName + "')]"));
}
请帮忙如何选择具体的下拉值?提前致谢。
慕哥6287543
大话西游666
相关分类