Showing posts with label DOM. Show all posts
Showing posts with label DOM. Show all posts

Thursday, 12 July 2012

Some QTP DOM Codes

On one of my friend's Request

Set totalUL = Browser("Jobs - Jobs in Gulf -").Page("Jobs - Jobs in Gulf -").Object.getElementsByTagName("UL")
For each ul in totalUL
    Print "UL list--------------------->" & ul.getAttribute("classname")
    If ul.getAttribute("classname") = "lc" then
        Set lis = ul.document.getElementsByTagName("LI")
        i = 0
        on error resume next
        Do
            Print lis(i).getAttribute("innertext")
            'once you have got the attribute you want, use instr function and then grab the complete text.
            if err.Description <> "" then
                on error goto 0
                exit do
            end if
            i = i+1
        loop while true
    End If
Next


-Pankaj Dhapola
Let's Think on it