recurse through the entire web page to find an element

How to recurse through the entire web page (dom structure) which contains frames, iframes and look for a particular element (say a button) ?
zazenzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark_FreeSoftwareCommented:

is it always the same button?

if so, then you can use InStr function
0
zazenzAuthor Commented:
that wouldn't work. in the first place how do i get hold of the source code for the iframe ?
0
Mark_FreeSoftwareCommented:

what is your starting point?

are you developing a plugin for ie/ firefox
are you reading a html file on your pc,
do you need to read html files on a server
do you have a webbrowser control in your app?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

zazenzAuthor Commented:
thanks for responding. its a html page on my PC.
0
zazenzAuthor Commented:
i'll elaborate this a bit, A recursive algorithm that parses the entire dom tree and shows if an element is present or not. any ideas on this would be greatly appreciated.
0
Mark_FreeSoftwareCommented:

do you want to compare it to a default page?
(same structure but then with different text or somthing?)

because you can parse it all, but i don't exactly understand what you are trying to do so it is very difficult to answer in the good direction
0
zazenzAuthor Commented:
Mark_FreeSoftware,
what I am trying accomplish here is look for a particular element (button) in the web page and click it. This page that I am talking about has many frames and is kind of complex with a huge dom structure. So my Vb program has to parse through each frame and look for if the element exists or not. and if the particular element exists then it has to take an action. I am working on writing the algorithm and any ideas regarding this is a great welcome.
0
Mark_FreeSoftwareCommented:

you could do somthing like this:


Dim tmp As String, tmp2 As String, i As Long
tmp = "<your<html> here>"
While tmp <> ""
    i = InStr(tmp, "<")
    If i > 0 Then
        tmp = Right$(tmp, Len(tmp) - i + 1)
        i = InStr(tmp, ">")
        If i = 0 Then MsgBox "Error in html!": Exit Sub
        tmp2 = Left$(tmp, i)
        'process whatever you want
        'the first element is now in tmp2
        tmp = Right$(tmp, Len(tmp) - i)
    Else
        tmp = ""
    End If
Wend


maybey you can even keep some sort of stack with the elements you encountered
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zazenzAuthor Commented:
thanks a lot, i'll give it a try and shall let you know about it.
0
zazenzAuthor Commented:
Mark_FreeSoftware,
           I figured it out. I used some of your ideas. and thanks for all the help.
0
Mark_FreeSoftwareCommented:


well, i'm glad you have figured somthing out!


and thanx for the points,
mark
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.