473,385 Members | 1,673 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,385 software developers and data experts.

Programatically click a web page button

Using C# and a web browser control, is there a way to programatically click a
web page button?
Dec 15 '05 #1
3 15574
KH
No, C# runs on the server, a button click occurs on the client. Try some
javascript.

..NET DLLs can be hosted as objects (like Java applets) in IE, but I don't
think that's what you're talking about.
"Pete" wrote:
Using C# and a web browser control, is there a way to programatically click a
web page button?

Dec 15 '05 #2
Pete,
Yes, assuming you have navigated the webBrowser control to the requested
page, and then obtained an DOM reference to the page model, you can use DOM
methods to call the submit method on the submit button of a form control, for
example.

But the real question is what do you *really* want to do? If this button
submits a form, you don't even need a webbrowser control for that. You can
simply construct a POST WebRequest with the correct multipart enctype and
send it out.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Pete" wrote:
Using C# and a web browser control, is there a way to programatically click a
web page button?

Dec 15 '05 #3
Thanks for the response. I will look at how to use the DOM reference as you
suggested. I did try it but didn't get too far and had wondered if there was
an easier way.

What I really want to do:

Basically, a windows form program that can aceess secure sites (that I have
valid access to) and mine some data.
I wanted to use HttpWebRequest/Response but couldn't figure out how to use
for https: sites.
Most sites want userid/password, some want userid/pword/pin.
I haven't been able to find a guide to show me how to handle logon info,
site redirection, cookies, etc (at least not that I could follow well enoguh
to get to work).
So, I thought the easiest way to accomplish would be to fill in login data
on the form using HtmlElement, and then submit the form by clicking the
button.

Filling in the form was easy, clicking the button not so easy.

If you have any good (hopefully relatively easy to follow) reference on how
to do this more efficiently, that would be great.

Thanks again,
Pete

"Peter Bromberg [C# MVP]" wrote:
Pete,
Yes, assuming you have navigated the webBrowser control to the requested
page, and then obtained an DOM reference to the page model, you can use DOM
methods to call the submit method on the submit button of a form control, for
example.

But the real question is what do you *really* want to do? If this button
submits a form, you don't even need a webbrowser control for that. You can
simply construct a POST WebRequest with the correct multipart enctype and
send it out.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Pete" wrote:
Using C# and a web browser control, is there a way to programatically click a
web page button?

Dec 16 '05 #4

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

Similar topics

4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
3
by: asr | last post by:
I've a form with a button on it. How to raise (I mean to run the code within the click event of the button) without clicking the button? Is it possible to raise the events programatically.
2
by: jw56578 | last post by:
if i have an Input type Image how am i suppose to programatically submit it through JS. code: <INPUT type="text" onkeyup="javascript:if(event.keyCode==13){btnClick.click();}"> <INPUT...
1
by: Carl Mercier | last post by:
Hi, I have a long form that post back to itself at different places (different controls). At the very end, I have a button called "Next" that post back to itself again causing some panels to be...
4
by: stb | last post by:
I have an empty asp:table on a form. Rows and cells in the rows are added programatically. At the end of each row, there is a cell with a button inside it. How do I catch the button's click...
11
by: Neo Geshel | last post by:
Greetings. Hopefully someone will be able to untie this Gordian Knot I have found myself bound up in. I am trying to add a submit button dynamically to a PlaceHolder. This button will help...
9
by: Neo Geshel | last post by:
I have strip-mined, strip-searched, and completely exhausted the Internet (up to the 30th page on Google, with 100 results per page!!), all without finding an answer to my question AS TO WHY IT...
0
by: OceanBreeze | last post by:
I have added a LinkButton to the web page programatically from server side code using ASP 2.0 and C# in my Page_Load method. I also associate this LinkButton with a LinkButton_ClickHandler_Edit and...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.