Forum Discussion

mkiewicz's avatar
mkiewicz
Occasional Contributor
9 years ago
Solved

EvaluateXPath finds object but FindAllChildren doesn't

I'm new to TestComplete after coming over from Selenium and C#, so apologies in advance if this question has been asked before. I am trying to set up the automation for a new product being developed with Angular 2.0 using the Page Object Model. I want to do this by putting the page objects and methods in a Javascript class, and calling that class from a test script when it's needed, performing the operation(s) I need, and moving on to the next step

 

It's working out well so far except when it comes to validation across a result set. I need to bring back an array of all of the results returned and traverse those results looking for a particular item. the problem I'm running into is this. My page object is called currWindow. The following statement returns the result set that I want

currWindow.EvaluateXPath('//sts-people-search-results-item');

 

I'd like to avoid using xpath because it's location dependent and since the application is being developed from scratch, there's a good chance that objects will be moved around. Preferably, I'd like to identify objects by attribute (id or class) or tagName.  The following statement should be equivalent to the above statement using EvaluateXPath, correct?

currWindow.FindAllChildren("tagName", "sts-people-search-results-item", 20);

But using FindAllChildren returns a blank variant array as if the result set tags aren't there. Am I doing something wrong? Is it because of Angular? Any help would be greatly appreciated

Thanks!!