submitting POST data forms with excel

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
I need to login to my bank account to grab some data for a spreadsheet. I have been struggling to submit the forms though and it is basically blocking all progress. I'll post what I have so far but I'm hoping someone can show me what is wrong...

The website in question is here.

The following macro will open the page, populate the username and password inputboxes, and try to submit the form but it doesn't work.

Code:
Sub Chase_Login()
    Dim vIE As Object
    Dim cTables As Variant
    
    Set vIE = CreateObject("InternetExplorer.Application")
    With vIE
        .Visible = True
        .Navigate "https://www.chase.com/"
        
        Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
        
        .Document.forms("logonform").usr_name.Value = "test1234"
        .Document.forms("logonform").usr_password.Value = "test1234"
        .Document.All.Item("logonform").submit
        
        Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  
    End With
        
End Sub

It gives a 404 error while trying to go to the following page:


I believe it is expecting the form submission as an encoded POST data packet, but I can't figure out how to submit it like that. The other problem is that I know next to nothing about HTML, so I don't even know what to submit. I've been researching this for several days and I know I need to send all of the form "members" in the POST data packet, but I have no idea what I'm looking at when I open the page source.

I am having this exact same problem on Bank of America's website so I am pretty sure the POST data thing is the problem.

One other thing that struck me as odd but I have no idea why - if I run the same macro posted above, except browse to the page you are directed to if you enter your password incorrectly, the form submission will work and I can login to my account. It doesn't really help me though as that same trick doesn't work on all of my other bank websites so I still need to figure out the real solution.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,703
4,661
75
It looks like what you're doing is not encoding the POST directly, but rather creating an IE instance, going to the right page, filling in the data, and "submitting". A few ideas come to mind:

  • Can you click a submit button to perform the submit?
  • Do you need to wait until something is done in Javascript before clicking the submit button?
  • Do you need to click the form fields before entering text in them? Sometimes that's necessary to activate some Javascript.
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
It looks like what you're doing is not encoding the POST directly, but rather creating an IE instance, going to the right page, filling in the data, and "submitting". A few ideas come to mind:

  • Can you click a submit button to perform the submit?
  • Do you need to wait until something is done in Javascript before clicking the submit button?
  • Do you need to click the form fields before entering text in them? Sometimes that's necessary to activate some Javascript.

Thanks for your reply. I've just been submitting the form as you can see from the macro as I don't know how to click the button. From what I can tell, there are 4 parts to the form:
  1. username
  2. password
  3. checkbox
  4. submit "button"

The first 3 have a name="..." so I can directly manage them, but the button is an image, not a real button. I don't know how to handle that so I can't click the actual button, or at least everything I've tried didn't work. That leaves me with submitting the form.

The following text is what I believe to be the relevant snippet of HTML for this form:

HTML:
<form onsubmit="return validateandsetcookie(document.logonform.usr_name,
 document.logonform.usr_password.value, 
document.logonform.remember.checked, '.chase.com','RBGLogon')" method="post"
 action="https://chaseonline.chase.com/siteminderagent/forms/formpost.fcc"
 autocomplete="off" align="center" id="logonform" name="logonform">

<input type="hidden" value="userpassword" name="authmethod"> 
<input type="hidden" value="en_us" name="locale"> 
<input type="hidden" value="" name="pagegentime"> 
<input type="hidden" value="RBGLogon" name="LOB"> 
<input type="hidden" value="/online/logon/on_successful_logon.jsp?LOB=RBGLogon" name="hiddenuri">

<div class="log_form_label"><label for="usr_name">User ID:</label></div>
<div>
<input tabindex="1" maxlength="32" size="15" id="usr_name" name="usr_name">
</div>
<div class="log_form_label"><label for="usr_password">Password:</label></div>
<div><input type="password" tabindex="2" maxlength="32" size="15" id="usr_password" name="usr_password">
</div>
<div class="log_form_label"><input type="checkbox" tabindex="4" class="logonCheckbox" id="remember" name="remember">
&nbsp;<label for="remember">Remember my User ID</label>
</div>
<div>
<a tabindex="5" href="https://chaseonline.chase.com/chaseonline/reidentify/sso_reidentify.jsp?LOB=RBGLogon">Forgot  User ID/Password?</a></div>
<div class="home_logon_button"><input vspace="0" type="image" border="0" tabindex="3" alt="log on" src="/online/Home/images/logon_button_home.gif">
</div>
</form>

As you can see, the bottom line, starting with

HTML:
<div class="home_logon_button">

is the image/button. If there is a way to directly click on that it might work. Otherwise, I'll need to figure out how to send a POST data packet. I'm fine with either way at this point.
 
Last edited: