dcsimg
Results 1 to 10 of 10
  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    [2.0] invoke submit[resolved]

    in a webbrowser control, how can I invoke a specific "submit" button? So if I have a button on the webpage its showing, and I know the name of it, how can I click on it as if I were?
    Last edited by Techno; Sep 11th, 2006 at 01:08 PM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Re: [2.0] invoke submit

    you dont even need to submit the button itself, you can submit the form
    jsut do document.MyFormName.submit()

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [2.0] invoke submit

    actually I cannot find that at all, ive been through it, in the webbrowser control properties/code

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [2.0] invoke submit

    ok to make it clear. If I have this code in an html page, and its showing in the webbrowser control:
    <input type="image" src="images/home/submit.gif" value="submit" border="0">

    I want to be able to click on it, as if I were clicking manually, but wish to do this programmatically using the webbrowser control in .NET 2.0

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [2.0] invoke submit[resolved]

    resolved

    simply get the elements by tag name of "Input", then go through each element, if the current element attribute value is "submit" then InvokeMember("click")

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  6. #6
    Banned
    Join Date
    May 2009
    Posts
    26

    Re: [2.0] invoke submit[resolved]

    can you give an example of that

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [2.0] invoke submit[resolved]

    HtmlElements elements = this.webBrowserControl.GetElementsByTagName("Input");

    foreach(HtmlElement currentElement in elements)
    {
    currentElement.InvokeMember("click");
    }

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  8. #8
    Member
    Join Date
    Mar 2010
    Posts
    32

    Re: [2.0] invoke submit[resolved]

    so if have more button then how can click in what button i want ?

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [2.0] invoke submit[resolved]

    thats what the foreach loop does.... goes through all the html elements and called the invokemember method for "click"

    you need to find your elements which are buttons or explicitly find the button by id then do an invoke member

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  10. #10
    Member
    Join Date
    Mar 2010
    Posts
    32

    Re: [2.0] invoke submit[resolved]

    If no one button have ID and how can do it ? You can give me a Exsample ? Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width