Yasser1984
Yasser1984

Reputation: 2451

Is there a way to type things in WebBrowser in Windows Forms?

I have a webBrowser (System.Windows.Forms.WebBrowser) in my windows form, And I have set the url property to "http://www.google.com", And when I run the solution, it shows google in my form.

My question is, can you programmatically write stuff in the search box?

Do I have access to DOM elements within the webBrowser and can I modify them?

Upvotes: 0

Views: 131

Answers (1)

makim
makim

Reputation: 3284

You can do so using the Document property of the WebBrowser control, something like this should work (not tested)

if (webBrowser1.Document == null) return;
var input = webBrowser1.Document.GetElementById("gbqfq")
input.SetAttribute("value","search for foobar");

hope this helps!

Upvotes: 2

Related Questions