Hi,
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:
Sys.Browser("*").Page("*").Link("ctl00_logOffButton").Click
-- 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
b) Watch https://support.smartbear.com/screencasts/testcomplete/reliable-tests-for-dynamic-objects/ and other relevant recordings from the https://support.smartbear.com/screencasts/testcomplete/ page.