Why click won't fire?

Discussion in 'ASP .Net Web Controls' started by Dave E, Mar 23, 2007.

  1. Dave E

    Dave E Guest

    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
    Dave E, Mar 23, 2007
    #1
    1. Advertising

  2. Dave E

    wmain Guest

    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
    wmain, Mar 24, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chad
    Replies:
    4
    Views:
    8,327
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,840
    Smokey Grindel
    Dec 2, 2006
  3. Mark Sisson

    UserControl click event won't fire

    Mark Sisson, Dec 2, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    118
    Thijs
    Dec 2, 2003
  4. CalSun

    dynamic loading - click event won't fire

    CalSun, Jul 8, 2005, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    139
    CalSun
    Jul 20, 2005
  5. Mark Sisson

    UserControl click event won't fire

    Mark Sisson, Dec 2, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    373
    Chris Thayer
    Dec 10, 2003
Loading...

Share This Page