Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am developing a winform application for the very first time.
In WebBrowser control, I am opening a particular page.
Is there any way to find the controls, hidden fields on the page opened in the browser control?

Thanks,
Lokesh.

What I have tried:

I googled a bit but could not find anything.
Posted
Updated 12-Dec-16 23:32pm

I googled and found lots of results?

webbrowser control find elements - Google Search[^]
 
Share this answer
 
Comments
Lokesh Zende 13-Dec-16 6:33am    
Thanks F-ES Sitecore :)
A web page is actually not a control container, so it doesn't have controls. essentially what exists in a WebBrowser control is the ability to service and present HTTP requests, to put it short plain text, which the actual browser then enterpret to more than that.

What you do have is a DOM Document Object Model - Wikipedia[^] and that's all you'll need.

The WebBrowser is a managed wrapper to an Active X control (COM) and it does proved access to the Document through which you CAN interact with a gotten page to some extend WebBrowser.Document Property (System.Windows.Forms)[^].

Back to the point you should be using JQuery in the browser if you at all can control the requested page for any and all interaction with a HTML Document.
jQuery - Wikipedia[^] you can get a reference to a DOM instance of an object (like control in client) and obtain the value by simply typing
JavaScript
var myTextBox;
myTextBox = $("#nameofdocumentobject");
var theValue;
theValue = myTextBox.val();

Or have a play with it in an editor Tryit Editor v3.3[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900