Yes, you are correct, neither Object Spy, nor Object Browser provide XPath expression as locator for some web element.
I think that the main reason for this is because TestComplete does not use XPath as a primary means to locate web elements and because XPath is specific for web elements, but TestComplete has a different unified approach that works for desktop, web and mobiles.
(In addition: why XPath? Why not css, for example? ;) )
And in addition to everything been said by all previous repliers:
TestComplete identifies and searches for tested objects within the tested application using arbitrary set of properties and their values (which may be wildcarded). By default, TestComplete tries to uniquely identify objects by using a subset of predefined properties (like id, etc.).
With this in mind: There are three main ways to search for the tested objects in TestComplete:
-- Direct objects referencing as provided in the Object Browser. You may see this type of referencing in the line above the list of properties available for the selected object within the objects tree. This is most simple, most straightforward and least stable way of addressing.
For your example, the reference might look like this:
-- Objects may be searched for using .FindXXX() methods (e.g. FindChild(), FindAlChildren(), FindAliasChild(), ...). The use of these methods is more preferable than XPath because of their much greater flexibility, performance and some other pecularities related to web page markup.
In theory, FindXXX methods can be chained like in your example, but this is inconvenient and is rarely used in real code.
-- The most advanced and recommended approach is to use Namemapping with Aliases. With this approach, you need first to build a tree of mapped objects and then adjust Aliases tree to your most convenience. After that your code may look like in Robert's example (i.e. Aliases.browser.page.logOffButton.Click) and remain pretty stable for certain page design changes.
I also would like to recommend you:
a) Read documentation, which is pretty detailed and descriptive for TestComplete; and
I appreciate all of the replies. As mentioned, ive had my skillset in UFT way back when it was Astra QuickTest. So migrating my skills to TC will be a process. Im not married to XPath. In fact, just started using it within the last couple of years. from my experience with it, it's one obj prop vs, at least two to sometimes 4 obj props to identify a single web element, e.g., an edit field. That said, my evaluation of this tool has been rewarding. Ive spent a couple of months getting it to integrate to VS and TFS -- and getting it to run tests via a build def. So havnt had the time to explore the scripting engine capabilities as much as I would have preferred to do. Sorry for the bold font,