Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Vbscript to Fill and Submit Web Form Help

$
0
0
I'm trying trying to figure out the last piece of this puzzle....the submit button. I'm creating a VBscript that will 1) launch a website, 2) fill in the neccesary fields in the html form, and 3) execute the submit button. I'm stumpped on step 3.

I got this to work most of the way using an automated Gmail login example:

Code:

On Error Resume Next
Const PAGE_LOADED = 4
Set objIE = CreateObject("InternetExplorer.Application")
Call objIE.Navigate("http://www.gmail.com")
objIE.Visible = True
Do Until objIE.ReadyState = PAGE_LOADED : Call WScript.Sleep(100) : Loop
objIE.Document.all.Email.Value = "ADDGMAILACCOUNT"
objIE.Document.all.Passwd.Value = "ADDGMAILACCOUNTPASSWORD"
Call objIE.Document.all.gaia_loginform.submit
Set objIE = Nothing

The code I've mimiced is as follows:

Code:

On Error Resume Next
Const PAGE_LOADED = 4
Set objIE = CreateObject("InternetExplorer.Application")
Call objIE.Navigate("https://www.marriott.com/reservation/lookupReservation.mi")
objIE.Visible = True
Do Until objIE.ReadyState = PAGE_LOADED : Call WScript.Sleep(100) : Loop
objIE.Document.all.cfmNumber.Value = "123456789"
objIE.Document.all.lname.Value = "SMITH"
objIE.Document.all.HTMLSUBMITBUTTONNAME.submit
Set objIE = Nothing

I've been trying to figure this out on my own for several days now and I need to come to the forum for help. Below is the section of the HTML code that I believe contains the inforamtion I'm looking for. But if not I've attached all of the HTML code. Thanks for help from anyone that knows HTML and VB more than I do.


HTML Code:

        <div class="formWrapper clearFloat">
                                <form id="reservationLookUpForm" method="get" action="/reservation/findReservationDetail.mi" class="required-information">
                               
                                       
                                       
                                                <input type="hidden" name="bc" value="MC" />
                                       
                               
                               
                                       
                                       
                                       
                                       
                                       
                                                <input type="hidden" name="returnURL" value="/reservation/lookupReservation.mi" />
                                       
                               
                               
                               
                                <div id="callOut2" class="call-out">
                                                <h3>
                                                        Find a Specific Reservation
                                                </h3>
                                                <p>
                                                        <label for="cfmNumber">
                                                        <span class="redText">**</span>Confirmation number
                                                        </label>
                                                        <input type="text" name="confirmationNumber" maxlength="8" value="" id="cfmNumber" />
                                                </p>
                                                <p>
                                                        <label for="lname">
                                                        <span class="redText">**</span>Last name
                                                        </label>
                                                        <input type="text" name="lastName" maxlength="30" value="" id="lname" />
                                                </p>
                                </div>
                                                <div id="buttons">
                                                        <span class="floatRight"><button type="submit" name="submit" id="find-reservaton" class="submit" title="Find">
                                                                <em>
                                                                        Find
                                                                </em>
                                                        </button></span>
                                                        <span class="floatLeft">* required</span>
                                                </div>
                                </form>
                               
                                <div id="lookup-forms-separator"><h2>or</h2></div>
                                <form id="directLoginForm" method="post" action="/directLogin.mi" class="required-information first">
                                <input type="hidden" name="bc" value="MC" />
                                <input type="hidden" name="returnURL" value="/reservation/lookupReservation.mi" />

                                <div id="callOut1" class="call-out">
                                                <h3>
                                                        Sign In to Browse a List
                                                </h3>


Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>