Re: DOM - WebBrowse - Get CLASS of TD (or other) elements?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: mayayana (mayaXXyaYYna1a_at_mindZZspring.com)
Date: 05/18/04

  • Next message: Salva Maiorano: "WebBrowser Control vs InternetExplorer Component"
    Date: Tue, 18 May 2004 12:46:15 GMT
    
    

      The TD tag has a className attribute. You can access
    any attribute as a property (Element.Attribute). Anything you
    can't get that way is usually available through the Style
    attribute, which gives you access to all style *** properties.

        Of course, first you need full info. about the properties.
    You really need a local copy of MSDN or a full DOM reference.
    The IE DOM is amazingly extensive and comprehensive, but it
    also has a quirky, patchwork quality to it. If you don't have access
    to a reference for all properties of all elements you'll end up doing
    a lot of frustrating testing because it often requires inventive
    workarounds to get at exactly the functionality or property that
    you want.

    --
    --
    Noozer <dont.spam@me.here> wrote in message
    news:Orlqc.521467$Ig.264634@pd7tw2no...
    > Of course as soon as you ask a question, you find the answer...
    >
    > Had to create an HTMLTableCell object and assign the element object to it
    so
    > I can access it's properties.
    >
    > ..of course I'd still like to hear any comments.
    >
    > > Is there a way to determine what class (if any) is applied to a TD
    > element?
    > >
    > > I'm trying to scrape some data from a webpage. The class of each result
    is
    > > the data being presented in the table. (ie <TD
    > class="user">username</td> )
    > >
    > > I'm using the code below to read the data from the DOM object. Using
    > > "element.class" causes an error. (unknown property or method) The
    TestOut
    > > sub just puts the text into a specific textbox.
    > >
    > >     For Each element In doc.All
    > >         Select Case element.tagName
    > >             Case "TABLE"
    > >                 TestOut " TABLE "
    > >             Case "FORM"
    > >                 TestOut " FORM name=" & element.Name & " ID=" &
    element.id
    > &
    > > " method=" & element.method & " action=" & element.Action
    > >             Case "INPUT"
    > >                 TestOut " INPUT name=" & element.Name & " ID=" &
    > element.id
    > > & " value=" & element.Value & " type=" & element.Type
    > >             Case "TD"
    > >                 TestOut "  TableData: data=" & element.innerText
    > >         End Select
    > >     Next
    > >
    > >
    >
    >
    

  • Next message: Salva Maiorano: "WebBrowser Control vs InternetExplorer Component"
  • Quantcast