Get element from web browser control in windows application

June 5, 2015

I required to get element from web browser control and also wanted to set its value.

I searched out on google and got some solutions , so i’d like to share with you guys.

Here is a code snippet,

private void wbBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
WebBrowser wb = (WebBrowser)sender;

wb.Document.GetElementById("txtCity").SetAttribute("value", "myValue");
wb.Document.GetElementById("txtName").SetAttribute("value", "myValue");