Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Why click won't fire?

Reply
Thread Tools

Why click won't fire?

 
 
Dave E
Guest
Posts: n/a
 
      03-23-2007
Hello,

I am having a rather annoying problem. I have written a program that
downloads a web page, fills in some fields then clicks a button to submit the
form. On some systems this works just great, on others the click event never
fires. I can get the form, fill it out, but when click is fired, nothing
happens. I am using the .net 2.0 webbrowser control to get the page and
access its elements. Here is the code I use to actually submit the form:

elcol = doc.Forms;
object obj = elcol[1].DomElement;
System.Reflection.MethodInfo mi = obj.GetType().GetMethod("submit");
mi.Invoke(obj, new object[0]);

I am assuming that since it works on some machines and not others, there is
some setting in IE or somewhere that causes this not to work. Anyone have
any suggestions?

Thanks,
--
Dave E
 
Reply With Quote
 
 
 
 
wmain
Guest
Posts: n/a
 
      03-24-2007
I use a slightly different approach. It has always worked for me.

Here is some example code that I use to parse a login form and click the submit button.

foreach (HtmlElement element in wb.Document.All)
{
if (element.Name == "username")
username = element;
if (element.Name == "store_id")
store_id = element;
if (element.Name == "password")
password = element;
if (element.Name == "processing")
processing = element;
}
if (username != null && store_id != null && password != null && processing!=null)
{
username.InnerText = "erttrtre";
store_id.InnerText = "wertwertwert";
password.InnerText = "wertertwt";
processing.InvokeMember("click");
}

---
Posted via DotNetSlackers.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
click click click Andy Morrison Computer Support 7 12-20-2007 06:50 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only Dirk Meusel ASP .Net 1 08-19-2003 09:56 AM



Advertisments