Forum Discussion
Hi Guillaume,
Another possible approach is to use the .EvaluateByXPath()/.FindChildByXPath() method (if you succeed to append the ng-reference="first-piece to the final html markup). Might appear to be quite convenient if you can identify some parent element not far from the sought for object.
Hi again.
Thanks for your answers.
@lage: I would rather avoid using textContent. I assume I can not base my object recognition using innerHTML. There are two many elements (ancestors) that will contains the specify HTML code. Beside, I think it might take longer to parse DOM using regexp.
@dganov: Thanks. Indeed, that might help ! I actually never tried to add a non-existing property to identify a object in NameMapping. It is a bit tricky but it would do the job.
@alex: I would also avoid using EvaluateByXPath. I use Keyword Test and I avoid as much as possible script as it become difficult to understand and maintain test case. I assumed xpath/css selector would work, but I am trying to use namemapping.
Since @dganov answers actually works, I am still wondering how could I have TestComplete Object Browser to add specific property added to Extended Properties...
For instance, the following code actually works. I guess TestComplete NameMapping implementation actually uses a similar mechanism to retrieve element.
var PropArray = new Array("ng-repeat", "Visible"); var ValuesArray = new Array("*", true); var ngRepeats = Aliases.theBrowser.page.FindAllChildren(PropArray, ValuesArray, 50, true); ngRepeats = (new VBArray(ngRepeats)).toArray(); for(var idx = 0; idx < ngRepeats.length; idx++ ){ Log.Message(ngRepeats[idx].getAttribute("ng-repeat")) }
Are there any other solution (less tricky and time consumming) that would let me configure TestComplete in order to directly provide some property within Object Browser and NameMapping ?! If ng-repeat (or ng-reference, or anything else I would like to configure) attribute exists, then add it to Extended Property !
I tried Open Applications / Web Testing / Object Identification but that is not what I am looking for.
Thanks !
Guillaume