ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Posting Login to webpage from VBA (https://www.excelbanter.com/excel-programming/306164-help-posting-login-webpage-vba.html)

Calligra[_2_]

Help with Posting Login to webpage from VBA
 
I have been working on this for a while and still having problems with
the code. I am attempting to complete a login page (not a message box)
that's on an asp webpage.

My problem is that I can get to the webpage, but seem to be unable to
login. My question is ... utilizing the IE object property where can I
locate the location of the text boxes to be filled? I have looked in
the document.documentElement.innerText but am unable to locate it. I've
tried utilizing both IE and XML but don't have a clue. Please help
someone.
Below is a snipit of my code...

Dim XML As XMLHTTP40
Dim abytPostData() As Byte
Dim sMode As String
Dim sResponse As String
Dim nStartPos As Integer
Dim nEndPos As Integer

Set IE = New InternetExplorer
abytPostData =
StrConv("Userid=blah&Password=password&Login=yes&m l=https://" & _
"ptlogin.asp?Login=Login;" & _

"menu_param=ptloginok.asp&yes=&   Y ES   "
& _
"bypass_oe=false", vbFromUnicode)

With IE
.Visible = True
.Silent = False
.navigate "https://ptlogin.asp?Login=Login;"
Do Until Not .Busy
DoEvents
Loop

nFile = FreeFile
Open "D:\Eagle\login.txt" For Output Shared As 1

Debug.Print 1, .document.documentElement.innerText
Close 1

Set XML = New XMLHTTP40
With XML
.Open "POST", _
"https://sits4/ptdev/ptloginok.asp"
.setRequestHeader "Content-Type", _
"application/x-www-form-urlencoded"
.send abytPostData
sResponse = .responseText



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com