Sign in to follow this  
Followers 0
phaze424

InternetExplorer Object -> Save HTML

2 posts in this topic

#1 ·  Posted (edited)

I've been using AutoIt3 for a few months now, but have only browsed the forums; I've never posted anything. However, I have a question: How can I save the current HTML from an InternetExplorer object? Normally, I would use InetGet(), but I'm trying to use PageScrape to scrape the page. The page requires me to log in (cookies, etc; most of you know what I'm talking about, so I won't go into it in depth.) Here's what I have so far:

Global $IEObject = ObjCreate("InternetExplorer.Application")
$IEObject.Navigate("http://www.somesite.com/login.php")
While $IEObject.Busy
    Sleep(200)
WEnd
$IEObject.document.getElementById("user").Value = "AutoIt3"
$IEObject.document.getElementById("pass").Value = "KicksAss"
$IEObject.document.getElementById("LoginForm").Submit()
Sleep(5000)
While $IEObject.Busy
    Sleep(200)
WEnd
; Do something
$IEObject.Quit()

I tried $IEObject.document.ExecCommand("SaveAs", 0, "SomePath"), but my script just hung. If I can't this to work, perhaps someone knows of a way to find the file corresponding to a specific URL in the cache, thus allowing me to use the ultimate powers of the copypasta? Thanks in advance for the help!

EDIT: I feel like an idiot. Just a couple minutes after posting this, I realized that I could just use $IEObject.document.Body.innerHTML. :) The topic can be locked, I suppose. I bet this first post gave you a great impression... :)

Edited by phaze424

Share this post


Link to post
Share on other sites



I bet this first post gave you a great impression... :)

Welcome to the forums, and trust me, there are WAY worse first posts all over the place.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0