none
VB.Net activation of Submit button on Log In page

    Question

  • I am seeking to log on to QRZ,com from a VB.Net program I am writing, and have the QRZ provide its regular page information to an Internet Explorer window, as a result of amateur radio call signs submitted to QRZ by the program.  I have been successful in getting the code to
    a. go to the login page of QRZ and put the username and password in the input boxes
    b. go to the regular users page and put call signs in the search input box and initiate the search.

    However, I have NOT been able to get the program to 'click' the submit button on the Login page.  The successes in b. above were after manually clicking the Continue button to complete the logging in.

    The code I have used follows.  All performs as expected except for the line shown in bold italics.
     
    Dim IEobj = CreateObject("InternetExplorer.Application")
    IEobj.navigate("https://www.qrz.com/login")
    Do While (IEobj.busy) : Loop
    IEobj.document.getElementsByName("username")(0).value = Trim(mQRZ_Username)
    IEobj.document.getElementsByName("password")(0).value = Trim(mQRZ_Password)
    IEobj.document.getElementByType("submit").Click
    IEobj.navigate("https://www.qrz.com")
    Do While (IEobj.busy) : Loop
    IEobj.document.getElementsByName("tquery")(0).Value = Trim(TboCallSign.Text)
    IEobj.document.getElementByID("tsubmit").Click
    The problem appears to be that there is no Name or ID assigned to the submit button (labeled 'Continue' ) to allow VB.Net to identify the submit button and click it.

    The HTML code segment for the QRZ Log in page, that defines the Username, Password, and Submit buttons, is as follows.  For simplification, I have stripped it of various <tr> & <td> code.  The entire page's HTML code can be viewed at https://www.qrz.com/login and selecting the source.
    Callsign:<input type="text" name="username" value="" size="12" maxlength="128">
    Password:<input type="password" name="password" value="" size="32" maxlength="64">
    input type="submit" value="Continue">
    How can I actuate the submit function via VB.Net software?

    bobgn1@cox.net

    Bob Goodwin

    Friday, April 14, 2017 8:54 PM

Answers

All replies

  • You need to find the submit button e.g. using getElementByName (or perhaps via GetElementsByTagName and use LINQ to go through the elements searching for the name of the button or perhaps the class or id) then if located use InvokeMember("click") on the element for the submit button.

    So let's say we used a variable Dim SubmitButton ... find it, validate you found it then use

    SubmitButton.InvokeMember("click")

    Sorry I don't use EnternetExplorer.Application object so no working example.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, April 15, 2017 12:51 AM
    Moderator
  • How can I actuate the submit function via VB.Net software?

    Input type "submit" does not submit. You need to submit the form using the form's submit method.  See the example here:
    http://www.tushar-mehta.com/publish_train/xl_vba_cases/vba_web_pages_services/index.htm#_Toc173749367

     
    • Marked as answer by BobGn Sunday, April 16, 2017 2:19 AM
    Saturday, April 15, 2017 1:19 AM
  • Acamar,
        Thanks for the quick response.  I see how the 'Submitting a Form' section works, as described in your link, and I found the section in my QRZ.com/login form HTML where the login form is named, but when I try using it with the code I had above, it reports that there is no ".submit" or ".click" defined for the object in the following code.

           IEobj.document.getElementsByName("loginform").submit

        I then shifted gears to set up the code syntax to be identical to the "Submitting a form" sample in your link, and immediately ran into a problem.  My Visual Studio 2017, using VB.Net, does not recognize 'InternetExplorer' as a valid object in the command, as you can see below

    This makes me wonder if I am missing a reference in my IDE that is necessary to recognize the 'InternetExplorer' object.

    If you see the fix to either issue, please advise.

    bobgn1@cox.net


    Bob Goodwin

    Saturday, April 15, 2017 12:16 PM
  • This makes me wonder if I am missing a reference in my IDE that is necessary to recognize the 'InternetExplorer' object.

    That's why people don't use the InternetExplorer object.  If you want to develop in VS 2017 you would be better off to develop an alternative approach. You will find it quite difficult to get assistance with that object, apart from what might already exist in old VBA tutorials.

    Saturday, April 15, 2017 12:23 PM
  • I was ultimately successful as a result of the link you provided.  Thanks.  It took a while as there were several 'names' and 'id's associated with the QRZ.com form but I ultimately found the right one and was able to stay with the 'InternetExplorer.Application' approach that I was using.  Clearly it is not very flexible and I need to learn a new approach but for now, the project is proceeding.

    Bob Goodwin


    Bob Goodwin

    Sunday, April 16, 2017 2:18 AM
  • I was ultimately successful as a result of the link you provided.  Thanks.  It took a while as there were several 'names' and 'id's associated with the QRZ.com form but I ultimately found the right one and was able to stay with the 'InternetExplorer.Application' approach that I was using.

    Thanks for letting us know that old example is still useful.

    Sunday, April 16, 2017 2:28 AM