witte
13 years agoOccasional Contributor
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!
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!