Jump to content

Help to get IE iFrame Source


Recommended Posts

<title>help iframe</title>

<iframe src="http://ucfish.webs.com/test.htm" framespacing="0" frameborder="no" scrolling="no" width="760" height="570" name="iframe_test"></iframe>

please help me get "http://ucfish.webs.com/test.htm" innerhtml source please...i cant get iframe innerhtml with au3 scripts , please help !

the example pages is http://ucfish.webs.com/iframe.htm

Edited by fishlester
Link to comment
Share on other sites

Maybe like this?

#include <IE.au3>
$oIE = _IECreate ("http://ucfish.webs.com/iframe.htm")
$oFrame = _IEFrameGetObjByName($oIE, "iframe_test")
$FrameHTML = _IEDocReadHTML($oFrame)
MsgBox(0, "",$FrameHTML)

Or, for inner html

#include <IE.au3>
$oIE = _IECreate ("http://ucfish.webs.com/iframe.htm")
$oFrame = _IEFrameGetObjByName($oIE, "iframe_test")
$FrameHTML = _IEPropertyGet($oFrame, "innerhtml")
MsgBox(0, "",$FrameHTML)
Edited by 871
Link to comment
Share on other sites

#include <IE.au3>

$oIE = _IECreate ("http://ucfish.webs.com/iframe.htm")

$oFrame = _IEFrameGetObjByName($oIE, "iframe_test")

$FrameHTML = _IEPropertyGet($oFrame, "innerhtml")

MsgBox(0, "",$FrameHTML)

i follow this scripts i get incorrect innerhtml source...

Link to comment
Share on other sites

How the correct one should look like?

is iframe source [http://ucfish.webs.com/test.htm]

<title>test</title>

<style type="text/css">

<!--

body,td,th {

color: #D4D0C8;

}

body {

background-color: #000;

}

-->

</style><!-- --><script type="text/javascript" src="http://images.webs.com/static/global/js/webs/usersites/escort.js"></script><script type="text/javascript">if(typeof(urchinTracker)=='function'){_uacct="UA-230305-2";_udn="none";_uff=false;urchinTracker();}</script>if(typeof(urchinTracker)=='function'){_uacct="UA-230305-2";_udn="none";_uff=false;urchinTracker();}</script>

Link to comment
Share on other sites

So you need everything between <html> tags. The first example I posted returns this, just remove <html> and </html>. You should study the help file, this is pretty basic.

#include <IE.au3>

$oIE = _IECreate ("http://ucfish.webs.com/iframe.htm")

$oFrame = _IEFrameGetObjByName($oIE, "iframe_test")

$FrameHTML = _IEDocReadHTML($oFrame)

MsgBox(0, "",$FrameHTML)

now i change my iframe target 'www.google.com.my' then i get this error...

C:\Program Files\AutoIt3\Include\ie.au3 (2024) : ==> The requested action with this object has failed.:

Return SetError($_IEStatus_Success, 0, $o_object.document.documentElement.outerHTML)

Return SetError($_IEStatus_Success, 0, $o_object.document^ ERROR

>Exit code: 1 Time: 2.746

Edited by fishlester
Link to comment
Share on other sites

#include <IE.au3>

$oIE = _IECreate ("http://ucfish.webs.com/iframe.htm")

$oFrame = _IEFrameGetObjByName($oIE, "iframe_test")

$FrameHTML = _IEDocReadHTML($oFrame)

MsgBox(0, "",$FrameHTML)

now i change my iframe target 'www.google.com.my' then i get this error...

C:\Program Files\AutoIt3\Include\ie.au3 (2024) : ==> The requested action with this object has failed.:

Return SetError($_IEStatus_Success, 0, $o_object.document.documentElement.outerHTML)

Return SetError($_IEStatus_Success, 0, $o_object.document^ ERROR

>Exit code: 1 Time: 2.746

Yeah because there is no frame on the google website named "iframe_test", what are you trying to do as getting iframe source doesn't look like what you want.

Link to comment
Share on other sites

Yeah because there is no frame on the google website named "iframe_test", what are you trying to do as getting iframe source doesn't look like what you want.

how can i get iframe souce? if iframe is target google.com i wan to get google source
Link to comment
Share on other sites

If you are on a page from some domain (other than google.com) and try to get the source of an iFrame whose src is google.com, _IEErrorHandlerRegister() will show you that you are getting Access is Denied (see cross domain scripting links in my sig).

You need to open a browser instance to the src url of the iFrame and then you can get its source.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...