How to fill WebBrowser TextBox's?

15,837

Solution 1

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.

Solution 2

Minor correction to the current answer

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

Solution 3

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.

Solution 4

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

Share:
15,837
Luiscencio
Author by

Luiscencio

I am Evil

Updated on June 04, 2022

Comments

  • Luiscencio
    Luiscencio almost 2 years

    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?

  • Luiscencio
    Luiscencio over 14 years
    did not think the solution was this simple
  • Luiscencio
    Luiscencio over 14 years
    do you know how to perform a click over an element?