Forum Discussion
Hi,
Can you provide (the screenshot of) the HTML markup source for some problematic sprite image (with several parents) and screenshot of how this section of HTML markup is recognized in the Object Browser ?
Please find the attachment for the html markup and the corresponding test complete object tree
- AlexKaras7 years agoChampion Level 3
Hi,
Thank you for the screenshots.
This is expected behavior of TestComplete: https://support.smartbear.com/testcomplete/docs/app-testing/web/general/object-identification/tree-model-elements.html.
Both Span elements are not included in the Objects Tree because from the markup point of view they are empty layout containers without any specified role. Thus, there is no reason to complicate Objects Tree and include them. Unfortunately, this is a drawback of the modern web design (forced by some web frameworks/libraries).
You may talk to your developers/designers and ask them to modify page source code to meet the requirements mentioned in the TestComplete's documentation referenced above.
If this is not an option, then you may use SimpleDataGridBuildingBlock1 object as a search root and search Add button using XPath. Note, that as the sought for button is absent in TestComplete's object tree, the search will return not TestComplete's wrapping object, but native DOM element.
The above means that the found button element will not contain methods and properties (like .Exists, .Click(), and so on) provided by TestComplete and you will not be able to use them in your test code. Use native DOM properties/methods (e.g. .click() ) to work with the returned element.
And the last note: as the XPath search may return either TestComplete's wrapping object or native DOM element, the correct way to check search result is like this (pseudocode):
<searchResult> = SimpleDataGridBuildingBlock1Obj.FindChildByXPath(...);
if (aqObject.IsSupported(<searchResult>, 'Exists')) then ' TestComplete's wrapper returned
if (<searchResult>.Exists) then ' object found
...
else
...
else ' native DOM element returned as a search result
if (null != <searchResult>) ' search succeeded
...
else ' XPath search failed
...
Related Content
- 4 months agoD0UG