using VBA to enter website login information

uwsp427

New Member
Joined
Aug 21, 2013
Messages
5
I am trying to automate the login to a website that I use regularly. I have written code that will succesfully:

1. Open the website
2. Enter the correct username
3. Enter the correct password

Whenever the code attempts to .submit the information I get a website error that states my username/password information is incorrect. However, when I deactivate the .submit and manually click "submit" with my mouse it logs into the website. One thing that I have noticed is that when I manually click "submit" the username changes from "MyUserName" to "********", but when the VBA code executes the .submit it does not make this adjustment. I am using Excel 2007 on a Windows 7 32 bit operating system. Here is the code:


Sub OpenSite()

Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject

Set ieApp = New InternetExplorer
ieApp.Visible = True

ieApp.Navigate "Website"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

Set ieDoc = ieApp.Document

With ieDoc.forms(0)
.UserId.Value = "Username"
.PIN.Value = "Password"
.submit
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Can you post the URL?

Without that it's pretty hard to help with this sort of thing.
 

artfj1

New Member
Joined
Nov 19, 2013
Messages
1
There is something flakey about the fidelity login page. I found that you have to enter the username twice, once into the "ssn" field, and once into the "ssn-visible" field. i.e.

iedoc.getElementsByTagName("ssn").item(0).value = "xxxxxxxxx"
iedoc.getElementsByTagName("ssn-visible").item(0).value = "xxxxxxxxx"
iedoc.getElementsByTagName("pin") .item(0).value= "yyyyyyy"
iedoc.getElementsByTagName("BUTTON").item(0).click
 

uwsp427

New Member
Joined
Aug 21, 2013
Messages
5
Thanks!!!!

This was dead in the water a few months ago for me and I moved on to some other means of getting the information I needed. But the solution was as simple as just changing the forms that the information was sent to. I was able to get your code to work and then I was able to also cut out the duplicative use of usernames. Here is the working code:

Sub GetTable()

'set variable types
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject

'create a new instance of internet explorer
Set ieApp = New InternetExplorer

'comment this section out if you don't need to open the browser;however, its useful for debugging
ieApp.Visible = True

'assume we’re not logged in and just go directly to the login page
ieApp.Navigate "https://login.fidelity.com/ftgw/Fas/Fidelity/RtlCust/Login/Init?AuthRedUrl=https://oltx.fidelity.com/ftgw/fbc/ofsummary/defaultPage"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

Set ieDoc = ieApp.Document

'fill in the login form

With ieDoc.forms(0)
.ssn.Value = "EnterYourUserName"
.PIN.Value = "EnterYourPassword"

End With
With ieDoc.forms(0)
.submit
End With
End Sub
 

Forum statistics

Threads
1,082,115
Messages
5,363,247
Members
400,722
Latest member
DrewPop24

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top