Solved

Webrowser Control - Qs - get tag properties etc

Posted on 2004-04-14
3
263 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

813 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

17 Experts available now in Live!

Get 1:1 Help Now