Forum Discussion
The problem is that the parentElement, being outside a function, is assigned immediately upon starting up the test run. So, if the application isn't running yet, that will have a "null" value or, if not null, at least be a "stub" object with no properties but the Exists property set to False.
You should probably wrap that variable declaration in such a way that it is not called until it is needed to avoid the above.
Something more like this:
function parentElement() { return Aliases.Program.InformationDisplay.WaitAliasChild('InfoDisplayWindow', 1000); } function InformationGrid() { this.localParent = parentElement();
this.Grid = this.localParent.FindChild("className", "info_container", 3); this.GridRows = this.Grid.FindAllChildren("className", "info-details", 5); this.GetDogName = function(rowIndex) { var name = this.GridRows[rowIndex].FindChild("className", "name-panel", 3).contentText; Log.Message(name); } }
- jmarkman6 years agoOccasional Contributor
The problem is that the parentElement, being outside a function, is assigned immediately upon starting up the test run. So, if the application isn't running yet, that will have a "null" value or, if not null, at least be a "stub" object with no properties but the Exists property set to False.
Ah, this is good to know. I'll use the wrapper you've suggested and see what that does for me, but I get the feeling this is what I needed.
Related Content
Recent Discussions
- 8 hours agomarkos