Solved

Webrowser Control - Qs - get tag properties etc

Posted on 2004-04-14
3
240 Views
Last Modified: 2010-04-17
q1 - I need to get the value of a table cell [I think it has no specific id or name]

q2 - I'm trying to list off the properties of the td tags but don't know any other properties to check [other than tagname and id], is there a WWW reference to all the objects and their respect properties for Webrowser1.Document...???

For Each iItem In WebBrowser1.Document.All.tags("td")
 Debug.Print iItem.tagname, iItem.Id
Next

- I figure there is a constant heading "Amount" in one cell, so if I get the ?text/value? from the next cell, I will be golden.



0
Comment
Question by:williamsF1
3 Comments
 
LVL 1

Accepted Solution

by:
someman4oneman earned 60 total points
ID: 10829208
Welcome to the land of DOM traversal.....
Here is some code that I ran in VB script which should give you an idea of
what you need to do.
'*******************************************************
'Get your list
Dim NodeList
Set NodeList = Document.getElementsByTagName("td")

'I am iterating with count instead of your collection
'because I use the count  to get the next node once I have got the amount node
For iItem = 0 To NodeList.Length - 1

            'The text in a td is a node so I get the
                'the child node of the TD and see if it equals "Amount"
            If NodeList(iItem).childNodes(0).nodeValue = "Amount" Then
                        'If it does equal amount then get the text of the next td node
                  MsgBox(NodeList(iItem + 1).childNodes(0).nodeValue)
            End If
Next
'*******************************************************

My test doc is

<html>
      <body>
            <table>
                  <tr>
                        <td>invalid</td>
                        <td>Amount</td>
                        <td>1000</td>
                  </tr>
                  <tr>
                        <td>Amount</td>
                        <td>1000</td>
                                <td>invalid</td>
                  </tr>
            </table>
      </body>
</html>

It may seem convoluted but  think the idea is to have a standard mechanism across all languages
for accessing XML.(thats Standards for ya) If I was to do the same thing in Java my code would look very similar.

0
 

Author Comment

by:williamsF1
ID: 10836150
I think I got this to work, but one last thing, how would I get the href value from

<TD align=right width="50%">
<A class=Blue href="https://192.168.0.10/preparer_1.asp">
Clickhere
</A>
</TD>
0
 

Assisted Solution

by:fungord
fungord earned 20 total points
ID: 10853399

For Each iItem In WebBrowser1.Document.Links
 if iItem.innertext = "Clickhere" then
    Debug.Print iItem.tagname, iItem.innertext, iItem.href
    Exitfor
 endif
Next

To find out move info on the object, while debugging you could 'add a watch' to iItem.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now