How to programatically get the UI Hierarchy in my automation script?

107 views Asked by At

I tried to store the result of target.logElementTree during automation in a variable. Have tried :

var op = target.logElementTree();
UIALogger.logMessage(op);

The Log result would be "null value" so I am trying to figure out on how to access that information by storing it during my execution ..

IN SHORT " I want to store the result of target.logElementTree() which is one way of doing it I believe.

Thanks for taking your time in going through till the end.

1

There are 1 answers

0
Ian On BEST ANSWER

logElementTree writes to the log, and does not return a value. The only way to get the hierarchy from within code is to recursively traverse it yourself, e.g. visiting the .elements() array of each element.