Forum Discussion

witte's avatar
witte
Occasional Contributor
12 years ago

FindAllChildren does not working correctly

Hi,

I have to test our new Silverlight 5 software, which is an Out-Of-Browser application.

After starting the tool, I'd like to click every tab or register and then I have to found all Buttons within this page.



Here is my simple Testfunction:

------------------------------

function startTest(){

  var slLauncher_Proc = Sys["Process"]("sllauncher");

  var slcontrol = slLauncher_Proc["FindChild"]("ObjectIdentifier","silverlightControlHost", 8, true);

  var pageParentChilds = new Array();

 

  toolname = "ConfigurationTool Application";

  //get register names

  cPages = definePages["pagesConfig"];

   

  tool = slLauncher_Proc["FindChild"]("WndCaption",toolname, 5, true);

  tool["Maximize"]();  

  register = slcontrol["FindChild"]("ObjectIdentifier", "ExtendedTabControl", 20, true);

  Log["Message"]("Anzahl der Register:" +itemsNumConfig);

   

  for(i=0; i<itemsNumConfig;i++){

      helper_references.createLogFolder("Register "+i);

      c = i+1;

      pagename = cPages["Page"+(c)]["Items"](1);

      helper_references.createLogFolder("Pagename: "+pagename);

      pageObj = register["FindChild"]("ObjectIdentifier",pagename+"*",100, true);

      pageParentChilds = new Array();      

      

      if(pageObj["Exists"]){

        pageParent = pageObj["Parent"];

        Log["Message"]("Parent Object of this Page = "+pageParent["Name"]);

        pageParent["Click"]();

        Log["Message"]("pageParent clicked");

        register["Refresh"]();

        Delay(2000);

        pageParentChilds = pageParent["FindAllChildren"]("ClassName", "Button", 100, true);

        pageParentChilds = (new VBArray(pageParentChilds))["toArray"]();

        Log["Message"]("pageParent childs searched." );

        if(pageParentChilds["length"]>0){

          Log["Message"]("found: " +pageParentChilds["length"]);

        }else{

          Log["Message"]("found nothing");

        }      

      }else{

        Log["Warning"]("Page not found!");

      }

      helper_references.closeLogFolder();

      helper_references.closeLogFolder();     

  }

}

-----------------------------------------

The object from where the childs have to be searched is always the current tab (for example => ["UIAObject"]("TabItem", 6)).

I dont see any problem in code, normally it should work?! But it always find buttons from only one tab ( the first one or the last one)  and sometimes no buttons. In Object Tree all elements are displayed.

I thought it could be a problem of refreshing or timing. But both I've changed and it has no effect.



So, I have no solution for my problem and hope you can help me!....

Please have also a look to attached picture with the object Tree structure.

Thanks!









 

2 Replies

  • witte's avatar
    witte
    Occasional Contributor
    I am despairing with this problem....



    It seems to me that my object hasn't the correct elements.

    But when I check the name of object by Log message, it is correctly. But even if I search for all objects what ever object it is, not all childs found.

    I don't understand this behavior because I also used the method since TestComplete 8.

    The onliest difference is that I have another application, Silverlight 5 as Out-Of-Browser.



    What is wrong? Should I use another function or anythink other is needed? 
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    This article contains requirements for testing out-of-browser Silverlight app. Are all of them met on your side?


    Also, to debug what is going wrong, I suggest that you save the current object tree before clicking the button on the tab and examine its structure. This may give you some clue.