Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET 2005 WebBrowser Control Button Click

Status
Not open for further replies.

neilkonitzer

Programmer
Jun 27, 2001
168
US
Greetings,
I am now using VB.NET 2005 and have a Winforms application with a WebBrowser control. I am trying to programmatically simulate entering in values on the web form and then following it by clicking a button on the form.

While I have no problem populating the text controls on the form with no problem...

WebBrowser1.Document.GetElementById("username").InnerText = "testLogin"
WebBrowser1.Document.GetElementById("password").InnerText = "testPassword"

I am not able to find a way to simulate clicking on the form's login button.

Anyone have any ideas?

For instance, WebBrowser1.Document.GetElementById("login").Click (the method does not exist)

Thanks in advance!

NOTE: I am familiar with using the COM web browser component, but would prefer to handle this with managed code.

Neil Konitzer
Freisoft Consulting Services, Inc.
 
1. The "login" is ID or name? I say this in case you saw wrong.
2. Is it in a 'form' container?
3. Do this: WebBrowser1.Document.GetElementById("login").click()

* I personally have done this thing; i mean to enter credentials and last hit the submit button.


Hope this helps you!
 
You are correct if I were using the COM component; however, I am using the WebBrowser control that comes part of .NET 2.0.

Neil Konitzer
Freisoft Consulting Services, Inc.
 
Of cource you are right! I'm sorry.

Here it is:

WebBrowser1.Document.GetElementById("ButtonID").RaiseEvent("onclick")

NOTICE: The ButtonID IS CASE SENSITIVE !


Hope this helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top