Home  »  Log   »   Https Capitalone Com C1 Login Aspx

Https Capitalone Com C1 Login Aspx

By | May 25, 2022

Log in to website using excel vba


    • #1

    I can not log in to a website using the VBA code and HTML described below. What am I doing wrong? Please help! I am new on this. Thanks.

    VBA Code


    HTML


    • #2

    Re: Log in to website using excel vba

    The login form is inside an iframe, which you need to access first:

    
    
    Set HTMLdoc = .document.getElementById("loginframe").contentWindow.document
    
    
    
    
    HTMLdoc.getElementsByName("username")(0).Value = "myUserId"
    
    
    
    
    HTMLdoc.getElementsByName("password")(0).Value = "myPassword"
    
    
    
    
    HTMLdoc.forms(0).submit
    
    
    
    
    Do While .readyState <> READYSTATE_COMPLETE Or .Busy: DoEvents: Loop
    
    
    


    • #3

    Re: Log in to website using excel vba

    Thanks, John, but I still have a problem. Now the username and password are entered apparently correctly, but I am getting a message that the information entered does not match what’s on file and goes back to the login page. There I enter the information manually and it works. So apparently it is not recognizing the information as entered by the program.


    • #4

    Re: Log in to website using excel vba

    Not having a valid account, I’m unable to test it. Try playing around with fireEvent on the user name input element for the various ‘on’ events in the HTML. E.g. fireEvent “onchange”.


    • #5

    Re: Log in to website using excel vba

    John,

    Below is the VBA code as it exists now. As you suggested I played with the “username” input statement FireEvents, but was not successful. I found out that the “username” statement and the “submit” statement in the code do not work. This is what I did:
    1. Logged in manually using the link used in the code and selected the “Remember Me” option and then logged out.
    2. Then I commented the “username” statement ran the code with a stop at the “submit” statement
    3. Then I entered “Myuserid” manually and resumed the code execution
    4. Result: Got the following message – “The information you entered doesn’t match what we have on file. Please check the information you entered.” and the password field was erased. I reenter the password and click the Login button and access the website successfully. (The page still remembers my username.). Then I logged out.
    5. Then I repeated step 2, entered “Myuserid” manually and clicked the Login button (the password was entered by the code) and logged in successfully.

    Can you take a look at the short Sub (attached code) to see if I am missing something and tell me specifically the different things that you would try to troubleshoot the problem? I am willing to pay for this. If I need to do that I will go through the proper website procedure and you can still help me.

    VBA CODE


    Sub capitalOne2() ‘Sub DOES NOT WORK

    Dim objIE As SHDocVw.InternetExplorer ‘microsoft internet controls (shdocvw.dll)
    Dim htmlDoc As MSHTML.HTMLDocument ‘Microsoft HTML Object Library
    Dim htmlInput As MSHTML.HTMLInputElement
    Dim htmlColl As MSHTML.IHTMLElementCollection
    Set objIE = New SHDocVw.InternetExplorer

    With objIE
    .navigate “https://servicing.capitalone.com/C1/Accounts/AccountSummary.aspx?LinkId=EOS_Z_Z_Z_EOSNAV2_H2_01_G_SSUM”
    .Visible = 1
    Do While .readyState <> 4: DoEvents: Loop
    Application.Wait (Now + TimeValue(“0:00:02”))

    ‘ set user name and password

    Set htmlDoc = .document.getElementById(“loginframe”).contentWindow.document
    htmlDoc.getElementsByName(“username”)(0).Value = “myUserId”
    htmlDoc.getElementsByName(“password”)(0).Value = “myPassword”
    htmlDoc.forms(0).submit
    Do While .readyState <> READYSTATE_COMPLETE Or .Busy: DoEvents: Loop
    End With
    End Sub


    • #6

    Re: Log in to website using excel vba

    I don’t see anything missing from your code (please use CODE tags), and that method would work for most websites, but this site has Javascript event handlers which are triggered by entering text in the username input box. Troubleshooting IE automation is usually just trial and error to see what works and the effect of different code. Sometimes I will run the code to a certain point, then start a loop which writes the HTML to a sequential file name and continue manually on the website and at the end look for differences in the HTML files.

    The following code includes some fireEvent calls which may or may not work for you. I get the expected “The information you entered doesn’t match what we have on file. Please check the information you entered.”

    If you want to pay for help, please ask a moderator to move this thread to the HIRE HELP forum http://www.ozgrid.com/forum/forumdisplay.php?f=105.


    • #7

    Re: Log in to website using excel vba

    Eureka!!! You nailed it.

    No sure how to contact the moderator to ask him/her to move the Thread to the Hire Help. I am going to give you $25 and pay the 10% fee. Let me know if that’s OK with you.

    Thanks,
    ER


    • #8

    Re: Log in to website using excel vba

    Ha ha! Nice one!!

    I had one or two other tricks up my sleeve if FireEvent didn’t work!

    Thank you for offering to pay – that’s very kind of you. To report the thread to a moderator, click the black warning triangle at the bottom left of one of your posts and they should be able to move it.


    • #9

    Re: Log in to website using excel vba

    OK, will do that.

    One more thing; the code I had to logout does not work now. Below is the code I was using and the HTML of part of the log out page. Thanks again.

    VBA Code

    IE.Quit
    Set IE = Nothingx
    Set objElement = Nothing
    Set objCollection = Nothing

    HTML

    <a id=”LNKCONTACT” href=”https://servicing.capitalone.com/C1/MyServices/Services.aspx”>Contact Us</a>
    </td>
    <td id=”cellDividerContact” class=”divider”>
    |
    </td>
    <td>
    <a id=”LNKLOGOUT” class=”logout” href=”https://servicing.capitalone.com/C1/SelfService/CMLogoutIntercept.aspx”>Sign Out</a>
    </td>
    </tr>
    <


    • #10

    Re: Log in to website using excel vba

    Try this inside the With IE … End With block:

    
    
    '<a id="LNKLOGOUT" class="logout" href="https://servicing.capitalone.com/C1/SelfService/CMLogoutIntercept.aspx">Sign Out</a>
    
    
    
    
    HTMLdoc.getElementById("LNKLOGOUT").Click
    
    
    
    
    Do While .readyState <> READYSTATE_COMPLETE Or .Busy
    
    
    
    
    DoEvents
    
    
    
    
    Loop
    
    
    


    • #11

    Re: Log in to website using excel vba

    Thanks, John.

    Inserted the code as suggested and I’m getting “Run-Time error 70”, Permission Denied.


    • #12

    Re: Log in to website using excel vba

    It could be that once logged in you need to load the HTMLdoc variable from the current IE.document object, or the LNKLOGOUT link is in an iframe. Here is the complete code showing both methods, with the second method commented out. Try the second method if the first one doesn’t work.


    • #13

    Re: Log in to website using excel vba

    You got it. Reloading “HTMLdoc = .document” did the trick.

    Thanks.


    • #14

    Re: Log in to website using excel vba

    Moved to hire help as requested.


    • #15

    Re: Log in to website using excel vba

    How do I pay (John W) and the 10% fee for a service already rendered? I see all kind of options and links in the website, but not one that says, “Pay Here”.

    Thanks for the help.
    ER


    • #16

    Re: Log in to website using excel vba

    You need to contact John and get his Paypal address, then whatever fee you agree pay 105 to ozgrid and the rest to John


    • #17

    Re: Log in to website using excel vba

    eromanrivera, per http://www.ozgrid.com/forum/showthread.php?t=104194 please pay the 10% fee via Paypal to [email protected] I’ll send a PM to you with my payment details.


    • #18

    Re: Log in to website using excel vba

    OK, waiting for the payment details. In the meantime I will try to figure out how to pay the 10% to [email protected] Never have made a payment that way.

    ER

Https Capitalone Com C1 Login Aspx

Source: https://forum.ozgrid.com/forum/index.php?thread/133978-log-in-to-website-using-excel-vba/

Popular:   Order Tupperware Com Sf App Tsf Frames Setup