CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2012
    Posts
    3

    Question clicking a html button programatically by vb.net

    I have to click a HTML button programatically which is on the 3rd page of the website. The button is without id. It has just name type and value. The HTML code of the button is given below

    <FORM NAME='form1' METHOD='post' action='/dflogin.php'> <INPUT TYPE='hidden' NAME='txtId' value='E712050-15'><INPUT TYPE='hidden' NAME='txtassId' value='1'><INPUT TYPE='hidden' NAME='txtPsw' value='HH29'><INPUT TYPE='hidden' NAME='txtLog' value='0'><h6 align='right'><INPUT TYPE='SUBMIT' NAME='btnSub' value='Next' style='background-color:#009900; color:#fff;'></h6></FORM>


    I am using the following code to click it






    For Each webpageelement As HtmlElement In allelements


    If webpageelement.GetAttribute("value") = "Next" Then

    webpageelement.InvokeMember("click")

    End If


    Next




    But I can not able to click it. I am using the vb.net 2008 platform to click it. Can anyone tell me the solution to click it?

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: clicking a html button programatically by vb.net

    have you tried GetElementByName instead of GetAttribute ?

  3. #3
    Join Date
    Jun 2012
    Posts
    3

    Re: clicking a html button programatically by vb.net

    No

  4. #4
    Join Date
    Jun 2012
    Posts
    3

    Re: clicking a html button programatically by vb.net

    Actually i dont know how to get element by name
    Last edited by HanneSThEGreaT; June 21st, 2012 at 02:10 AM.

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: clicking a html button programatically by vb.net

    I thought you would have googled it by now....

    I googled it for you, do not worry. I do not have much work, so that I can search the whole internet, especially for you....

    http://stackoverflow.com/questions/5...l-with-c-sharp

    http://msdn.microsoft.com/en-us/libr...bytagname.aspx

    http://msdn.microsoft.com/en-us/libr...mlelement.aspx

    OK, I see now it is actually GetElementByTagName, but google still worked

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured