我需要从下拉列表中选择一个值,这样可以帮助我。 HTML部分在下面
<div id="element11_chzn" class="chzn-container chzn-container-single" style="width: 320px;">
<a class="chzn-single" href="javascript:void(0)" tabindex="0">
<div class="chzn-drop" style="left: -9000px; width: 318px; top: 29px;">
<div class="chzn-search">`enter code here`
<ul class="chzn-results">
<li id="element11_chzn_o_1" class="active-result" style="">ActiveLearn Course</li>
<li id="element11_chzn_o_2" class="active-result" style="">ActiveLearn Player</li>
<li id="element11_chzn_o_3" class="active-result result-selected" style="">ActiveLearn Skin</li>
<li id="element11_chzn_o_4" class="active-result" style="">ActiveLearn Template</li>
<li id="element11_chzn_o_5" class="active-result" style="">Activity</li>
<li id="element11_chzn_o_6" class="active-result" style="">Animation</li>
<li id="element11_chzn_o_7" class="active-result" style="">Assessment</li>
<li id="element11_chzn_o_8" class="active-result" style="">Bookmarks</li>
<li id="element11_chzn_o_9" class="active-result" style="">Character</li>
<li id="element11_chzn_o_10" class="active-result" style="">Click to prompt</li>
<li id="element11_chzn_o_11" class="active-result" style="">Click to prompt override</li>
<li id="element11_chzn_o_12" class="active-result" style="">EBook</li>
<li id="element11_chzn_o_13" class="active-result" style="">Exercise</li>
<li id="element11_chzn_o_14" class="active-result" style="">Game</li>
<li id="element11_chzn_o_15" class="active-result" style="">Glossary</li>
<li id="element11_chzn_o_16" class="active-result" style="">Glossary Term</li>
<li id="element11_chzn_o_17" class="active-result" style="">Glossary Term</li>
<li id="element11_chzn_o_18" class="active-result" style="">Imported file</li>
<li id="element11_chzn_o_19" class="active-result" style="">Interactive activity</li>
<li id="element11_chzn_o_20" class="active-result" style="">Interactive page</li>
</ul>
</div>
我必须使其动态,因此我需要从xls获取值。
最佳答案
这应该为您工作:
Select select = new Select(yourDropdownElement);
select.selectByVisibleText(text);