Micro Focus QTP (UFT) Forums
Collecting Objects And Object State At Runtime - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Collecting Objects And Object State At Runtime (/Thread-Collecting-Objects-And-Object-State-At-Runtime)



Collecting Objects And Object State At Runtime - zunebuggy - 11-02-2017

I have tried several online examples for this, but none of them worked.

At my work we have a web based application where the user enters a CODE and is taken to a webpage that has a form with hundreds of objects on it.

Each webpage is unique and actually ALL the possible objects are always on this particular page, some are just not visible and/or enabled.

I need to programatically collect each object name and state (visible, not visibleenabled, disabled) and dump this data to a spreadsheet or a pipe delimited text file (that I will import into Excel).

I have all the possible CODES in the Global Table section of UFT and it will now loop through each CODE and land on the page that I need to collect data from.  It currently takes a screenshot but I do not want to go though all 200+ screenshots and manually list each visible item.

I'd rather do it once and collect the data in Excel.  Then I can get the developers to sign off on the DOM data I collected as our official Requirements because currently they do not have any requirements to give us. (for real!!).

I'll list below one of the online examples I tried and the error I got.  If anyone can help me accomplish this I would appreciate it.  


Code:
ChilObjs = Browser("my actual correct browser name was here").Page("my actual correct page name was here").Childobjects

tol=Chilobj.count

for i = 0 to UBound(tol)

a =chilObjs(i).Name
print a

Next


The error I get is "Wrong number of arguments or invalid property assignment: 'ChilObjs'"

And I was just trying to get the name here, not even trying to get whether the object was visible or enabled yet.

Thank you for your time,


Rolleyes


RE: Collecting Objects And Object State At Runtime - Ankur - 11-04-2017

At the first glance I can see a syntax error

Chilobj.count 

(You missed the s , Chilobjs.count)


RE: Collecting Objects And Object State At Runtime - zunebuggy - 11-15-2017

I fixed that syntax error and it still won't do what I need it to do.  Has anyone accomplished this?

Thank you


RE: Collecting Objects And Object State At Runtime - supputuri - 11-22-2017

Hey,

you have to use the GetRoProperty method and fetch the object property and values, rather simply saying .Name.

Try the below.
chilObjs(i).GetRoProperty("innertext") or chilObjs(i).GetRoProperty("text")