473,385 Members | 1,973 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 15575
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.