Sign in to follow this  
Followers 0
jezzzzy

ie.au3 quick problem

5 posts in this topic

#1 ·  Posted (edited)

Can't seem to read text associated with a tag or id. Trying to simply read the contents of a tag or and id to a variable. Not sure what I'm missing. I've gone through the IE help. I have a feeling I'm about to feel dumb. Code looks like this:

$wObjIE = _IECreate($wURL)
    $wTitle = _IETagNameGetCollection($wObjIE,"h3")
    MsgBox(0,"Title",$wTitle.name)
    _IEQuit($wObjIE)
oÝ÷ Ø    l¢ÚâyÛaÆ®¶­s` b33c·tö&¤RÒôT7&VFRb33c·uU$ b33c·uFFÆRÒôTvWDö&¤'æÖRb33c·tö&¤RÂgV÷C¶7FÃô6öçFVçEÆ6TöÆFW%õFFÆTVFW"gV÷C² ×6t&÷ÂgV÷CµFFÆRgV÷C²Âb33c·uFFÆRææÖR ôUVBb33c·tö&¤R

Partial source of the page I am trying to read is this:

<div id="productBox" class="purchaseContainer">
        <div id="ctl00_ContentPlaceHolder_SaleTagPanel" class="saleTag">
            <h3 id="ctl00_ContentPlaceHolder_TitleHeader">Page Item Title</h3>

All I need is for $wTitle to equal "Page Item Title". I need to be able to "read" what is contained in the object.

Edit: I have thought about reading the source into a variable, but then I would need to strip out the text between the tags and somehow only pull the Nth tag, etc.

Edited by jezzzzy

Share this post


Link to post
Share on other sites



Can't seem to read text associated with a tag or id. Trying to simply read the contents of a tag or and id to a variable. Not sure what I'm missing. I've gone through the IE help. I have a feeling I'm about to feel dumb. Code looks like this:

$wObjIE = _IECreate($wURL)
    $wTitle = _IETagNameGetCollection($wObjIE,"h3")
    MsgBox(0,"Title",$wTitle.name)
    _IEQuit($wObjIE)
oÝ÷ Ø    l¢ÚâyÛaÆ®¶­s` b33c·tö&¤RÒôT7&VFRb33c·uU$ b33c·uFFÆRÒôTvWDö&¤'æÖRb33c·tö&¤RÂgV÷C¶7FÃô6öçFVçEÆ6TöÆFW%õFFÆTVFW"gV÷C² ×6t&÷ÂgV÷CµFFÆRgV÷C²Âb33c·uFFÆRææÖR ôUVBb33c·tö&¤R

The first example returns a collection, so you need to specify which instance you want... _IETagNameGetCollection($wObjIE,"h3", 0). In both cases you don't want .name, but rather .innerText

Dale

Partial source of the page I am trying to read is this:

<div id="productBox" class="purchaseContainer">
        <div id="ctl00_ContentPlaceHolder_SaleTagPanel" class="saleTag">
            <h3 id="ctl00_ContentPlaceHolder_TitleHeader">Page Item Title</h3>

All I need is for $wTitle to equal "Page Item Title". I need to be able to "read" what is contained in the object.

Edit: I have thought about reading the source into a variable, but then I would need to strip out the text between the tags and somehow only pull the Nth tag, etc.


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

Share this post


Link to post
Share on other sites

Try this:

#include <IE.au3>

_IEErrorHandlerRegister ()

$sUrl = "your url here"
$oIE = _IECreate($sURL)
$oTags = _IETagNameGetCollection($oIE, "h3")
For $oTag In $oTags
    If $oTag.Id == "ctl00_ContentPlaceHolder_TitleHeader" Then
        $sTitle = $oTag.innerText
        ExitLoop
    EndIf
Next
MsgBox(0, "Title", $sTitle)

Share this post


Link to post
Share on other sites

Thank you guys. Was missing .innerText.

Where is that information listed so I don't have to bother you with stupid questions in the future?

Share this post


Link to post
Share on other sites

Thank you guys. Was missing .innerText.

Where is that information listed so I don't have to bother you with stupid questions in the future?

No problem, MSDN is a great reference.

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