2011-11-16 159 views
0

有人可以幫我選擇選項查詢從下面的代碼?我嘗試過但失敗。使用硒在下拉菜單中選擇一個選項


<div class="SplitButton" id="HIRA_SPLITBUTTON" splitBtnName="pyDescription" btnType = "menu" onSplMenuClick='HIRA.ui.gadget.NewWork.StartProcess4Menu'> 
    <select id="pyDescription"> 
     <option value='className&#61;HIRAFS-Work-Inquiry&amp;flowType&#61;Inquiry&amp;HarnessVersion&#61;1'> Inquiry </option> 
     <option value='className&#61;HIRAFS-Work-Copy&amp;flowType&#61;Copy&amp;HarnessVersion&#61;1'> Copy </option> 
    </select> 
    <table class='buttonMainTable' border='0' cellspacing='0' cellpadding='0' id='' > 
     <tr> 
      <td class='buttonTdLeft'> 
      <div class="buttonLeftContent"> 
       <div class="buttonLeftContentInner"> 
        &nbsp; 
       </div> 
      </div></td><td class='buttonTdMiddle'> 
      <button class='buttonTdButton' alt='' title='' HIRA_VERSION='HTMLPROPERTY' id='HIRA_SPLITBTNpyDescription'> 
       <table cellspacing='0' cellpadding='0'> 
        <tr> 
         <td valign='top'><img src='desktopimages/new.gif' style='margin-top:-1px'/></td><td valign='middle' style='white-space:nowrap;'>New</td> 
        </tr> 
       </table></span> 
      </button></td><td class='buttonTdRight'> 
      <div class="buttonRightContent"> 
       <div class="buttonRightContentInner"> 
        &nbsp; 
       </div> 
      </div></td> 
     </tr> 
    </table> 
</div> 
+0

@strah:你是怎麼處理這個[建議編輯](http://stackoverflow.com/suggested-edits/612169)的評論?此處的編輯歷史記錄建議您選擇修改建議,但沒有審覈操作的記錄。想要過來[這個元問題](http://meta.stackexchange.com/questions/170175/community-is-a-review-monkey-too/170176#170176)並在你身邊添加發生在這裏的事情? –

回答

1

您必須引用的webdriver支持DLL做到以下幾點。

SelectElement select = new SelectElement(element); 
select.SelectByText("Inquiry"); 

如果您使用的是帶有的NuGet視覺工作室,那麼你可以去你的PowerShell並鍵入

Install-Package Selenium.Support 

,這將安裝所有你所需要的參考資料和DLL。

+0

不得不離開這個...一段時間,忙於一些事情。我仍然無法選擇 – Srinivas

相關問題