?
Solved

Webrowser Control - Qs - get tag properties etc

Posted on 2004-04-14
3
Medium Priority
?
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
someman4oneman earned 240 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 80 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans
Suggested Courses

801 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