Jump to content

Trouble accessing html within iFrame


Recommended Posts

Good morning everyone,

I'm having an extremely difficult time extracting any kind of html from an iFrame on this website I am working with. I've been working on this for a few hours, and have come up with slim to no results. I'll paste my code/the html of the page I am working with and talk more about the bare results I have received.

**As far as I am aware, there is one, and only one frame on the entire website**

#include <Array.au3>
#include <IE.au3> ;for _IE()

$oIE = _IECreate("http://www.ExampleWebsite.com/")
$oFrames = _IEFrameGetCollection($oIE ,0)
$iNumFrames = @extended

For $i = 0 to ($iNumFrames - 1)
    $oFrames = _IEFrameGetCollection ($oIE, $i)
    MsgBox(0, "Frame Info", _IEPropertyGet ($oFrames, "height"))
Next

The result from this code: I get two MsgBox's (entitled "Frame Info"), and they both come back with "0"... I was expecting a height (maybe 700, like the html dictates)... let alone trying to get an html element (<li class=), which is ultimately my goal. I know it seems lengthy, but please bear with me.

<iframe style="width:700px;height:700px;border:0;padding:0;margin:0;" frameborder="0" src="http://www.TheFrameURL.com"></iframe>



    <div class="blank1">
        <div class="blank2" style="display:block;visibility:visible;"></div>
        <div class="blank3" style="display:none;"></div>
        <div class="blank4">

            
                <ul class="blank5" id="blankID1">

                
<li class="blank6 " id="blankID2" style="display:block;" onclick="simulateBannerClick('click.php?dynamicParameter=1001-5191-x126-771971-65f1614-11880-16251-0-987-1-5-CA-1-1-0-0-0-0-2c9fa11d', '', '', '', 0, 0, '16251', '11880', false);">
    <span></span>
    <table class="blank7" id="blankID3">
        <tbody><tr>
            <td class="blank8" rowspan="2">
                <h1 class="blank9" id="blankID4"><span>294</span>A little bit of text</h1>
                <div class="blank10" style="display:block;">
                   <img src="http://www.IMAGE.com" alt="5">
                </div>
                <div style="display:block;">
                    <div class="blank11" dir="LTR">More text here</div>
                </div>
            </td>
            <td class="top">
                <table id="blankID5" class="blank12"><tbody><tr></tr></tbody></table>
            </td>
            <td class="blank13" width="100%">
                <div class="blankID6">
                    <h2 class="blank14 titleColor" id="blankID7">Some text here</h2>
                    <p class="blank15" id="blankID7">random text</p>

                    <p class="blank16" id="blankID8"></p>
                    <div class="blank17" title="blank_title1" style="display:none;" onclick="stripClose('16251','11880',event)"></div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <p class="blank18" id="blankID9">blank small descript. text</p>
            </td>
        </tr>
    </tbody></table>
    <div class="blank19">
        <div class="blank20" id="blankID10"><span>123 (number)</span> TEXT</div>
        <div id="blankID11" class="blank21" dir="LTR">BUTTON TEXT</div>
    </div>
</li>
</ul>

Above is the associated HTML code with my script. Although, I haven't been able to pull anything from this HTML, the script's purpose was to read "700" instead of "0" in the MsgBox entitled "Frame Info". Now, I haven't seen much support for iFrame's on the forum/via Google search, hence the reason I've brought fourth this abnormally long post.

If anyone has even the slightest clue, don't hesitate to post. All creative criticism and help are welcomed with open arms.

*whewf* :)

Thanks for taking the time to read.

Sincerely,

Manic

Link to comment
Share on other sites

  • Moderators

You are calling _IEFrameGetCollection() with an index value of zero. This returns a frame object if one exists, but you are treating it as a collection object. Try the code below and see what results you get.

#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IECreate("http://www.ExampleWebsite.com/")
$oFrame = _IEFrameGetCollection($oIE, 0)
If @error Then Exit
MsgBox(0, "Frame Info", _IEPropertyGet($oFrame, "height"))
Link to comment
Share on other sites

height=0 is correct.

See first iframe definition of page:

<iframe height="0" src="http://domdex.com/f?c=196&amp;k=example+website,Dating+website+templates,Pokemon+Schwarz,Cheap+website+templates,Download+vb,Web+Design+Courses,Website+Design+for+Free,Cool+Web+Page+Design,Free+Web+Design+Templates,Good+Web+Design+Examples,Web+Design+for+Artists,Web+Design+E+Commerce,Cheap+Web+Design+Software,Portfolio+Website+Design,Web+Design+with+Flash,Web+Design+and+Web+Hosting,Cost+of+Web+Design,UK+Web+Design+Companies,Non+Profit+Web+Design,Ecommerce+Web+Design+Company,Web+Design+in+Manchester" frameBorder="0" width="0"></iframe>

App: Au3toCmd              UDF: _SingleScript()                             

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...