03-29-2010, 11:28 PM
I have the same issue with ChildObjects on a web page. In some cases I found this helps:
It seems some description objects use Regular Expressions to do the search, this turns it off and in the case of using "html tag" it does make the search for ChildObjects quicker and less error prone with there are a large number of objects.
However, it will still fail if there are x-thousands of objects. This occurs in QTP 9.5 and 10, so there is a limit to the number of objects it can handle. The only "work around" I can find is:
The error you are getting is because the variable is null/empty, I think. So you have to handle that and let your code continue. I just record the message and move on letting my devs no I can't test that many objects, usually a table, and they need to break it up if possible, or provide test data that doesn't fail.
Hope this helps.
Code:
wElement("class").RegularExpression = "false"
It seems some description objects use Regular Expressions to do the search, this turns it off and in the case of using "html tag" it does make the search for ChildObjects quicker and less error prone with there are a large number of objects.
However, it will still fail if there are x-thousands of objects. This occurs in QTP 9.5 and 10, so there is a limit to the number of objects it can handle. The only "work around" I can find is:
Code:
on error resume next
Set cComps=Browser().Page().PSFrame().ChildObjects(cComp)
if not isEmpty(cComps ) then
'do something
else
Reporter.ReportEvent micWarning, "cComps", "Returned Empty"
end if
on error goto 0
The error you are getting is because the variable is null/empty, I think. So you have to handle that and let your code continue. I just record the message and move on letting my devs no I can't test that many objects, usually a table, and they need to break it up if possible, or provide test data that doesn't fail.
Hope this helps.