Ask a Question




Hi all,


I am a newbie on testcomplete. I am trying to use the FindChildByXPath to find/validate the title of the page. I am not sure what is wrong in this line. The error I get says 'label' is undefined. I have made sure that the classname is correct and ttl does populate the correct title name. All the line is supposed to do is to trturn back the obj so that next step I can compare the obj.contentText with the page title and confirm that it is the same.


obj = page.FindChildByXPath("//DIV[@class='classnameforrightColumn']/descendant-or-self::*[contains(text(),'" + CutOffString(ttl) + "')]");


Any ideas anyone? 


thank you.


Champion Level 0

Hi @aa1 ,


if your requirment is to retrive the title of the page please find the below code snippeet.

function getPageTitle()
var page = Sys.Browser("chrome").Page("*");

Kind Regards,

Sathish Kumar

Champion Level 3



As it is documented and was mentioned here several times, search by XPath in TestComplete can return either wrapper object with all properties and methods added by TestComplete or native DOM object. In the latter case (which seems to be yours) you may use only native DOM methods and properties (potentially - browser specific:

For example:


  /Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.

Hi Sathish,


Thank you for the reply. Actually I am not looking for the title of the page. I need to have the title in one of the divs/page section. So this code will not work for me. I need to play with the id or the class of the div but I am not able to figure out how to do that.


Anyway, thanks for the suggestion.





Thank  you for the suggestion. I understand the downside. I will see what I can do.




SmartBear Alumni (Retired)

Hi @aa1,


Do you mind sharing with us the solution you decided to use?

Tanya Yatskovskaya
SmartBear Community and Education Manager

Hi @TanyaYatskovska ,


The issue solved by itself without me changing anything. I had updated the code base from the trunk. Seems that a change in some other part of the code got this issue fixed as well. Since I new to this and the project, I dont still have the full picture. But I think we can mark this as resolved since the issue is not there any more.



Showing results for 
Search instead for 
Did you mean: