Forum Discussion
My objective is to access the Web Elements "wrapper".
Any way it does not matter for me. Is there a way to acccess it using TestComplete build-in methods?
We use these wrappers extensively in Selenium (with help of JavaScript executor).
It's very simple to access in TestComplete but the way it return the values hinted me that TC does not handle these stuffs.
Looks like potential issue with TestComplete when handling wrapper "objects" (may be known issue).
As shown in below picture, see...
[1] -- webElements is an array founded the elements using QuerySelectorAll. webElements [0].wrapper evaluated as Object, but when I inspected it, its just empty
[At this point, I moved on searching for someother solution and started exploring contentDocument.Script.eval]
[2] --- Same as [1], no details dispalyed for the object "Data"
[3] --- When I accessed the Object Data property "C3", corresponding String value is displayed
[It would be better 'Object' wrapper values also considered]
Thanks,
Saravana
- AlexKaras6 years agoChampion Level 3
Hi Saravana,
Thank you a lot for describing your approach. Quite useful.
> when I inspected it, its just empty
As it is documented for the QuerySelectorAll() method:
"
If a TestComplete web object matches the specified selector, then the array item contains this object.
If there is no matching TestComplete test object, the array item holds the appropriate HTML object.
If neither matching test objects, nor HTML objects were found, the method returns an empty array.
"
So, the above means that in your case TestComplete was able to find sought-for objects, but they did not match any object from TestComplete's objects tree in the Object Browser and thus native DOM objects were returned as the result of the search.
Native objects do not contain methods and properties added by TestComplete (e.g. .Exists, etc.) and (usually) cannot be inspected. However all their native methods and properties are accessible and can be used from test code (as it is illustrated on your screenshot #[3]). You just need to read the documentation for this or that DOM object for the provided native methods/properties.
- SaravanaKumar_N6 years agoContributor
Thanks a lot for your detailed explanation.
I read that and thought it is applicable for a search using CSS locator which is true (returns empty array if locator does not match).
I did not think that would be same for their Native objects as well (that where your experience comes :) ).
And I just found that this is not just the case for QuerySelectorAll, even if I go with the ObjectTree FullName property of an object, same result.
So its "NativeObjects" of Web elements I believe.