Submitting a form programmatically [duplicate]
Possible Duplicate:
How do you programmatically fill in a form and 'POST' a web page?
I've been looking for a way to allow a user to submit a form using C# or even HTML,so I get the source code, save it in a file and get the name of the text fields in order to submit the form.
for example logging with ur email to Facebook, gmail,stackoverflow ... or any page containing a form.
Before I ask how,is it possible? My project is mainly to help visually impaired people surf the web easier! like get any html source code and be able to re-arrange the tags, omit images and such tags that won't benefit them,and try to give them the ability to log in using speech to text ...so my code will take the speech convert it to text field by field and submit the form when he/she's done! of course the name of the fields will be spoken usin开发者_StackOverflow社区g text to speech!
Thanks in advance
Have you looked at the WebBrowser
control?
http://msdn.microsoft.com/en-us/library/aa752041(v=vs.85).aspx
It will allow you to automate surfing. You'll also be able to interact with the pages and modify values in text boxes, click buttons, submit forms.
Here's some talk about how to handle clicking. http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/2eed72f7-4fde-4730-abf7-738e9b6e87c4/
I've used that approach successfully in the past, but I will say it's problematic if you don't/can't control the website. If I write a program that will automate logging into facebook with this method it would require me telling it what URL to visit, what textboxes to fill, and what form name or button name to click.
If Facebook redesigns their layout - my code may no longer work.
If you are just interested in the logging in part; you might want to take a look at browser addons (I don't know if this will help at all, but I thought I would mention it). I use a product called, 'LastPass' (https://lastpass.com/) and it manages all of my user names and passwords. If I visit a site it is familiar with, it can automatically fill in the forms for me, allowing me to log in or completely enter my address.
精彩评论