2013-05-20 63 views
0

我需要爲下拉框編寫腳本。在同一屏幕上有兩個下拉元素,並且兩個下拉框都具有相似的類名(下拉框是搜索和選擇類型),並且沒有任何元素的唯一標識。 因此,腳本可以很好地從第一個下拉列表中選擇元素,但是它在第二個下拉列表中應該執行相同操作時會失敗。在webdriver中搜索具有相同類名的元素

做回覆

問候

<div class="title-edit-form" id="49156080-2097-ea0f"> 
<div class="control-group required"> 
<label class="control-label">Title 
</label> 
<div class="controls row-fluid"> 
<div class="select2-container span12 select2-container-active select2-dropdown-open" id="s2id_title">  
<a href="#" onclick="return false;" class="select2-choice" tabindex="-1"> 
<span>de</span> 
<abbr class="select2-search-choice-close" style="display:none;"> 
</abbr> 
<div> 
<b></b> 
</div> 
</a>  
</div> 
<input class="span12" id="title" type="hidden" style="display: none;" value="-1"> 
</div> 
</div> 
<div class="select2-drop select2-drop-active" style="display: block; top: 177px; left: 536px; width: 530px;"> 
<div class="select2-search">  
<input type="text" autocomplete="off" class="select2-input select2-focused" tabindex="-1" style=""> 
</div> 
<ul class="select2-results"> 
<li class="select2-results-dept-0 select2-result select2-result-selectable select2-new"> 
<div class="select2-result-label"> 
<span class="select2-match">de</span> 
</div> 
</li> 
<li class="select2-results-dept-0 select2-result select2-result-selectable"> 
<div class="select2-result-label"> 
<span class="select2-match">De</span> 
"an" 
</div> 
</li> 
<li class="select2-results-dept-0 select2-result select2-result-selectable select2-highlighted"> 
<div class="select2-result-label"> 
"Stu" 
<span class="select2-match">de</span> 
"nt" 
</div>`enter code here` 
</li> 
</ul> 
</div> 
+0

你可以將你的HTML嗎? – e1che

回答

相關問題