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!!
I think I got it. It's a little bit of roundabout way to go about this, but it's effective and pretty easy. I take the page object and get a count of the results and use a for loop to a iterate through the,m. using the xpath for the results item tag (in this case it's ''//sts-people-search-results-item''). Taking the xpath and the index of the loop I have access to the underlying tags using xpath expressions that evaluate to an attribute as such to access a name (e.g. "//sts-people-search-results-item//a[@class="name']") . This removes the location dependency and allows my script to traverse the results
Thanks!!!