Luiscencio
Luiscencio

Reputation: 3965

How to fill WebBrowser TextBox's?

I want to log on to this site with my company's user and password from a winforms application, I am displaying the page on a webBrowser control, any Ideas?

Upvotes: 3

Views: 16277

Answers (5)

Crash893
Crash893

Reputation: 11702

Minor correction to the current answer

webBrowser1.Document.GetElementById("ctl00$cphMainPageBody$txtDUNS").SetAttribute("value" ,"123456");

Upvotes: 4

Ramazan BASTURK
Ramazan BASTURK

Reputation: 11

to perform a click over an element: webBrowser1.Document.GetElementById("clientlogin").InvokeMember("click");

Upvotes: 1

geekonweb
geekonweb

Reputation: 394

You need write code to find controls by tag or id like

webBrowser1.Document.GetElementById("textName").SetAttribute("value") = "ddddd" ;

Before this code just make sure document is completely loaded. You can use WebBrowserDocumentCompletedEventHandler to do a check for this.

Upvotes: 7

shahkalpesh
shahkalpesh

Reputation: 33474

There is a web-UI testing framework called watin. But this does many things other than what you are looking for & I don't know, if you really need such a thing.

Upvotes: 1

AaronLS
AaronLS

Reputation: 38367

Install Firebug in Firefox, and open the firebug console to view the postback that is sent when you login. You can then use this information to perform a postback using WebRequest class to login directly from your Winform application.

Upvotes: 0

Related Questions