473,327 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

WebBrowser Control - simulate click

If I have an aspx page loaded in a web browser control, can I simulate a mouse click on a particular button control ?
Sep 7 '08 #1
4 6766
It's pretty clear I am not an expert.

What I have is a web page I've got using a web request to a url and getting the web response.

What I want to do is find a particulat control and simulate a mouse click.

Sep 7 '08 #2
If you have used HttpWebRequest (or WebClient), then you will have to
do it all manually. If you are using WebBrowser, then you can do this
quite simply by using DHTML - for example, to click the "I feel lucky"
button on Google's home page:

HtmlElement el = webBrowser1.Document.All["btnI"];
if (el != null) el.InvokeMember("click");

Marc
Sep 7 '08 #3
Hi

It depends if the button executes some Javascript in the onclick
event. That, I think, you cannot simulate. But if the button just
submits a form, you can grab the form's action attribute and create a
new HttpWebRequest with that address.

Regards
Steve

On Sep 7, 3:02*am, Ian Semmel <isemmelNOJ...@NOKUNKrocketcomp.com.au>
wrote:
It's pretty clear I am not an expert.

What I have is a web page I've got using a web request to a url and getting the web response.

What I want to do is find a particulat control and simulate a mouse click..
Sep 8 '08 #4


Marc Gravell wrote:
If you have used HttpWebRequest (or WebClient), then you will have to
do it all manually. If you are using WebBrowser, then you can do this
quite simply by using DHTML - for example, to click the "I feel lucky"
button on Google's home page:

HtmlElement el = webBrowser1.Document.All["btnI"];
if (el != null) el.InvokeMember("click");

Marc
Thanks. I changed to web browser and got it to work.
Sep 8 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robert | last post by:
How can I simulate a click on an anchor element from a links-collection in the WebBrowser control? I'm using VS 2005 and the WebBrowser control in .NET 2.0. Do you have any suggestions? Thanks...
2
by: cweeks78681 | last post by:
I am porting some VB6 code that automates navigation through a web page by getting all the <a> tags into a collection and then calling the Click method on the appropriate one. How do I click a...
2
by: jasonhartsoe | last post by:
I'm using Visual Studio 2005 Team Edition....using visual basic. I'm trying to use the webbrowser control. In the webbrowser control I have it got to a page where there is a form. It waits for...
11
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
0
by: Bob Bryan | last post by:
After adding a WebBrowser control to my form (VS 2005), and the following 2 lines of code to a click event: webBrowser1.Navigate(new Uri(NextURL)); String PageData = webBrowser1.DocumentText; ...
2
by: JDeats | last post by:
Using VS.NET 2005, if you place a WinForms WebBrowser control on a form, then place a command button on that form and in the "click" even handler for the command you do: webBrowser1.DocumentText...
1
by: Rotsey | last post by:
Hi, I have a form with a webbrowser control set to fill the form. I want to capture when the form is clicked. As the browser control is filling the form the user would click on the browser...
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
11
by: kimiraikkonen | last post by:
Hi there, I needed to use MouseOver event on Webbrowser which is NOT provided by webbrowser control natively(what a disappointment), so i decided to go with another route to simulate this like: ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.