Forum Discussion

esramirez's avatar
esramirez
Contributor
12 years ago

Please - Help me to understand something



I am using FindChild to locate a ui component on the screen. The full name of this object is as follow:



Sys.Process("myProcess").WPFObject("HwndSource: Login", "MASTER").WPFObject("Login", Log On to myApp", 1)



By mistake, In my code did as follow:



var MyParent = Sys.Process("myProcess").WPFObject("HwndSource: Login", "MASTER");



var MyChild  = MyParent.FindChild(WPFObject("Login", Log On to myApp", 1)); 

This worked ... It located the object without any problem. If you noticed however the name of the child Log On to myApp has one double quote missing at the beginning and what I don't understand is how FindChild worked when the syntax is not correct?



any thoughts?


1 Reply

  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)

    Hello Enrique,

    The behavior you describe is unexpected for TestComplete. And it is not just the missing double quotes, but also the parameter you pass to the FindChild method.

    The FindChild method takes two obligatory parameters - the array of property names and the array of specified properties' values (please see the description of the FindChild method in our Help system), while you pass only one parameter to the method. It is very strange that the FindChild method does not throw any errors and returns you a correct object.

    I have tried to reproduce the described behavior and failed. Could you please send us your project (or a sample project that demonstrates the problem) so that we could investigate this behavior?

    Thanks in advance.


    By the way, if your object is a direct child of the Sys.Process("myProcess").WPFObject("HwndSource: Login", "MASTER") object, you do not need the FindChild method to access it. You can just refer to the object by its name. For example:



    var obj = Sys.Process("myProcess").WPFObject("HwndSource: Login", "MASTER").WPFObject("Login", Log On to myApp", 1);



    You can find more information on this in the "Addressing Objects in WPF Applications" Help topic.

    If you have any additional questions or need anymore assistance, please do not hesitate to contact us via Contact Support Form or via this forum.

    Thank you.