2

goal: log into the web page and save the html to a file for parsing later.

the html on the page is just a list of users and when they logged in and off.

When you load the web page up a javascript box pops up and asks for login information

i can fill this with SendKeys but i really want to do this without a window popping up

Set IE = CreateObject("InternetExplorer.Application") 
set WshShell = CreateObject("WScript.Shell")  

IE.Visible = False ' doesn't set IE page as invisible?????

IE.Navigate "https://mysite/site/console/client-log.jsp"
      'how do i fill in the box ???
1
  • 2
    I see distinction between the title and actual question, however, if you have not an access to the source of that web page to modify it design, then how you expect to skip that popup dialog? Commented Feb 16, 2013 at 20:31

1 Answer 1

3

I'd suggest to use something like Fiddler to identify the request that does the actual login, and then use that information in an XMLHttpRequest.

url      = "..."
filename = "..."

Set req = CreateObject("MSXML2.XMLHTTP.6.0")
req.open "POST", url, False
req.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
req.send "field1=foo&field2=bar&..."

Set fso = CreateObject("Scripting.FileSystemObject")
fso.OpenTextFile(filename, 2, True).WriteLine req.responseText

If the response is UTF-8 encoded you may need to use an ADODB.Stream object for saving the content.

Set stream = CreateObject("ADODB.Stream")
stream.Open
stream.Type     = 2 'text
stream.Position = 0
stream.Charset  = "utf-8"
stream.WriteText req.responseText
stream.SaveToFile filename, 2
stream.Close
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.