Search code examples
arraysvbscriptqtphp-uft

QTP - lbound() and ubound()



I'm having some troubles doing something easy: checking the most recent date in an array.
I create an array of webelements. There are some dates in this array in "fixed" places and I want to take the most recent of them.
This is what I'm doing:

    Set cc = Description.Create
    cc("micclass").value="WebElement"
    cc("name").value="arrow_down"
    Set collcc=Browser("Br").Page("Page").ChildObjects(cc)

    For i=lbound(collcc)  to ubound(collcc)
        Msgbox collcc(x).getroproperty("innertext")
        x =x +9
    Next



The problem is that the script stops at the beginning of the for, saying that there is a "wrong number of arguments or invalid property assignment ubound" (and the same happens with lbound.
What am I doing wrong?!


Solution

  • Just from memory, but i think ChildObjects does not return an array. Try with

    for i = 0 to collcc.Count - 1
        ....
    next