[英]C# WebBrowser Control Masked ListBox
我正在嘗試創建一個將以編程方式完成表格的程序。
表單上的“收款人”字段使用可搜索的列表框。
我正在使用下面的代碼將文本放在下拉框中,但是它並沒有像從列表中搜索和選擇那樣激活它。
webBrowserWB.Document.GetElementById("select2-chosen-4").InnerText = payee;
我將如何模仿擊鍵以鍵入需要輸入該字段的值? 還是還有其他選擇?
下圖是列表框的示例。 直到用戶開始在字段中輸入值時,值才會顯示。
編輯以包含HTML
<div class="select2-drop select2-display-none select2-with-searchbox
select2-drop-active" id="select2-drop" style="display: block; left:
6.5px; width: 781px; top: 240px; bottom: auto;">
<div class="select2-search">
<label for="s2id_autogen4_search" class="select2-
offscreen">Payee</label>
<input type="text" autocomplete="off" autocorrect="off"
autocapitalize="off" spellcheck="false" class="select2-input"
role="combobox" aria-expanded="true" aria-autocomplete="list" aria-
owns="select2-results-4"id="s2id_autogen4_search" placeholder="">
</div>
<ul class="select2-results" role="listbox" id="select2-results-4"><li
class="select2-no-results"></li></ul></div>
我能夠使用Selenium來解決我的問題,而不是使用WebBrowser控件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.