Micro Focus QTP (UFT) Forums
Dealing with Malformed HTML - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Dealing with Malformed HTML (/Thread-Dealing-with-Malformed-HTML)



Dealing with Malformed HTML - Rodrigo Carvalho - 05-16-2011

Hi Guys, greetings from Mexico!

I have to automate a Web-Based application which has a "dirty" HTML code. The issue is that the HTML is malformed (e.g. tables, column and rows not closed, unclosed links etc..) and QTP is not recognizing elements correctly on the page.

I have tried descriptive programming but that's not enough since i'm trying to pull data from tables that sometimes are not recognized. I have also tried pulling data from all "available" tables within the page (even this way... some tables are not pulled, seeem to be invisible)...

Any ideas guys? Really need some help! Sad


Example of my code:
(even using this function, some data is not retrieved)

Code:
tblData = getAllTablesInnerText()

Function getAllTablesInnerText()

    Dim i, num, rc, oDesc, roProperty
    Dim cadObjs, arrObjs
    Dim regexBrowser, regexPage
    Dim innerText
    Dim textTables

    roProperty = "innerText"
    regexBrowser ="title:=.*Enlace.*"
    regexPage = "title:=.*Enlace.*"
    
    Set oDesc=Description.Create
    oDesc("micclass").Value= "WebTable"

    Set rc = Browser(regexBrowser).Page(regexPage).ChildObjects(oDesc)
    num = rc.Count() '

    For i=0 To num -1
        print "Parseando tabla " & i & "..."
       innerText = rc(i).GetROProperty(roProperty)
        textTables = textTables & "<TABLA " & i & ">:" & innerText
    
    Next

    getAllTablesInnerText = textTables

End Function
'********************************************************************************