Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Description object does not work, anybody know why?
#1
Not Solved Question 
Hi!

I once wrote a little tool function, which collects all error messages (all objects having the class *error*) on a page/table. Basically it works fine, but it seems not on all pages. There is a certain one, where it just won't pick up the <p> tags. To be more exact, if I use ChildObjects() without a decription object it will pick up 14 items, but in all of them the "class" is empty (when debugging or outputting it in qtp), even though in the html source cleary shows that those html items do have a class set. Also I tried using the whole page as parent, or the WebTable those messages are in, but it does not make a difference.

In the following is the code of that function, and further down the html (-snipplet, only the one table with the messages) where it should actually work on, but it does not.

Thanks for reading and potentially helping!
CC

Code:
Function getAllErrorMessagesOnPage(parentObject)
    Dim errorDescription
    Dim allErrorMessages
    Dim i
    Dim returnValue
    Set errorDescription=Description.Create

    if(isNull(parentObject) or not parentObject.exist(2)) then
        Exit function
    end if

    errorDescription("class").value = ".*error.*"
    errorDescription("class").regularexpression =true

    set allErrorMessages=parentObject.ChildObjects(errorDescription)  
    For i=0 to allErrorMessages.count-1
       returnValue=returnValue+allErrorMessages(i).getRoProperty("innertext")+";"
    Next
    getAllErrorMessagesOnPage=returnValue
End Function

html code (not that the classes are set)
Code:
<table class="blueTop"width="100%">
    <tr>
        <th colspan="2">Uploaded Files</th>
    </tr>
    <tr>
        <td colspan="2"><p class="errorText">Error</p><p class="errorText">You must correct the following error(s) before proceeding:</p><p class="errorText"><img src="/images/new/cross.gif">&nbsp;image is not JPeg/GIF format</p></td>
    </tr>
    <tr>
        <td valign="top">
            <select name="removedFiles" size="5" multiple>
                
            </select>
        </td>
        <td align="right" valign="bottom">
            <input type="image" name="" src="/images/new/remove.gif" onclick="remove(document.dealerCatBImageUploaderForm)">
        </td>
    </tr>
    <tr>
        <td class="boldText">
            Current total = 0  K
        </td>
        <td align="right">
            <input type="image" src="/images/new/finish.gif" onClick="window.close();">
        </td>
    </tr>
</table>
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find out the object property in the Description language . njnirmal 9 6,261 05-19-2015, 12:30 AM
Last Post: qtptester66523
  Description.Create with same propertie and different values, not working ttralor 2 2,338 01-13-2013, 12:11 AM
Last Post: ttralor
  Error while creating object using description.create object in VB script SarodeGirish 5 5,806 06-19-2012, 05:30 PM
Last Post: ssvali
  Problem while adding description of an object using a varibale shibinp 2 3,262 08-25-2011, 10:51 AM
Last Post: shibinp
  descriptive programming- object description vnicey 3 4,366 11-24-2010, 01:02 AM
Last Post: Anu123

Forum Jump:


Users browsing this thread: 1 Guest(s)