开发者

How to fill out a form field without a name in webbrowser control?

开发者 https://www.devze.com 2022-12-26 15:46 出处:网络
In the past, I used the code below to fill out a form field using the webbrowser control in VB.Net. The page I am working with doesn\'t have name field for the inputbox, so my code doesn\'t work. How

In the past, I used the code below to fill out a form field using the webbrowser control in VB.Net. The page I am working with doesn't have name field for the inputbox, so my code doesn't work. How would I fill out the input box defined at the bottom of this post in bold?

Dim iPage As HtmlDocument
iPage = wb1.Document
iPage.All.Item("case_num").InnerText() = caseNum
iPage.All.Item("button1").InvokeMember("click")

**<input type="text" id="tbSymbolLookupMain" mode="mixed" autocomplete="off" defaulttxt="Enter Name or Symbol(s)" value="E开发者_如何学JAVAnter Name or Symbol(s)" class="SymbolLookup  fhHandleFocus fhDefault">**


Is input in your question actual data you work with? You can try to use HtmlDocument.GetElementById to find it by id. But unless I'm mistaken what you do should already work as MSDN states Item("some name") on HtmlElementCollection uses "some name" to match both by Id and Name. So you might use your usual way but provide id instead of name

0

精彩评论

暂无评论...
验证码 换一张
取 消