0

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 allButtons

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

            webpageelement.InvokeMember("click")

        End If

    Next

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

1 Answer 1

3

I was having the same problem as you. The InvokeMember looks correct so I can only assume its not picking up the correct html element. Try refering to the element explicitly using the value. The following code worked for me but I have adapted it for you:

 For Each webpageelement As HtmlElement In allButtons
      If webpageelement.GetAttribute("value").Equals("E712050-15") Then
        webpageelement.InvokeMember("click")
        Exit For
      End If
 Next

Good Luck :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.