thao-nhi
asked on
Opening a website and submit a value to a specific field in access 2016
I'd like automate the process of opening a web page, submit a tracking number and run the page to get the status in Access 2016 vba via a click event of a button. Attached is how the tracking webpage is like. Any help is appreciated.
tracking-page.JPG
tracking-page.JPG
ASKER
Could you help further with examples of webbrowser control to post the tracking number and get the result? Thanks
Not as long I don't know that site. Cause it solely depends on it.
UPS? FedEx? USPS? Something else? As ste5an said, it depends on what site you are using
ASKER
Canada post is the site.
ASKER
First of all: Your previous screen shoot is completely different then what I see on www.canadapost.ca.
CAVEAT: I don't know whether it is legal use of that site to do this (IANAL).
But just take a look at the tracking form:
So just send a post request to /cpotools/apps/track/perso nal/findBy TrackNumbe r where the parameter name is trackingNumber and the value URL encoded.
As an exercise for you and to help to understand what you need to do: Use Fiddler to see the corresponding HTTP traffic.
CAVEAT: I don't know whether it is legal use of that site to do this (IANAL).
But just take a look at the tracking form:
<form enctype="application/x-www-form-urlencoded" action="/cpotools/apps/track/personal/findByTrackNumber" method="post" name="widgetForm" id="widgetForm">
<label for="csho" class="visually-hidden">Enter the Number</label>
<select class="csho" id="csho" data-placeholder="Select Your Options">
<option value="tracknumber" selected="selected">Tracking number</option>
<option value="deliverynotice">Delivery notice card number</option>
<option value="referencenumber">Reference number</option>
</select>
<label for="trackingNumber" class="visually-hidden">Enter the Number</label>
<input type="text" placeholder="Example: 23476542897" id="trackingNumber" name="trackingNumber" title="Enter the Number" />
<span class="searchpipe"> </span>
<div class="searchButton">Find</div>
<div class="tracknumber">
<span class="trackingText">
Enter up to 24 tracking numbers, separated by commas
</span>
</div>
<div class="referencenumber">
<div class="outsideref">
<span class="trackingText">
Enter up to 24 numbers, separated by commas
</span>
<div class="row">
<div class="large-6 medium-6 small-6 columns">
<label for="dateFrom" style="visibility: hidden;">Date From</label>
</div>
<div class="large-6 medium-6 small-6 columns">
<label for="dateTo" style="visibility: hidden;">Date To</label>
</div>
</div>
<div class="row"><!--ct-->
<div class="large-6 medium-6 small-6 columns">
<input type="text" class="radius" value="" id="dateFrom" placeholder="Date From">
</div>
<div class="large-6 medium-6 small-6 columns">
<input type="text" id="dateTo" value="" class="radius" placeholder="Date To">
</div>
</div>
</div>
</div>
<div class="deliverynotice">
<span class="trackingText">
Enter up to 24 tracking numbers, separated by commas
</span>
</div>
<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
</form>
So just send a post request to /cpotools/apps/track/perso
As an exercise for you and to help to understand what you need to do: Use Fiddler to see the corresponding HTTP traffic.
ASKER
Thanks for the help but so far I still have no idea how to go about this.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A normal HTML form can be queries by using MSXML2.XMLHTTP with the appropriate POST form variables.
Otherwise you need a WebBrowser control and automate it.