royd
8 years agoRegular Contributor
Problem with "FindAllChildren"
I am trying to find all menu items. I am getting error "Unable to find the object aspnetForm.", see the screcapture bellow. I am new to Jscript, Probably making a simple mistake, help is much appreci...
- 8 years ago
You dont't need to convert the below to array.
mainMenu.FindAllChildren("ObjectType","link", 50, true);
When you use FindAllChildren by default it will return as a Array.
FYI.
- FindAllChildren Method (Common for All Test Objects)Declaration
TestObj.FindAllChildren(PropNames, PropValues, Depth, Refresh)
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section PropNames [in] Required Variant PropValues [in] Required Variant Depth [in] Optional Integer Default value: 1 Refresh [in] Optional Boolean Default value: True Result An array of the tested objects.
Once you got the list of menus available from the Pane to menuChild object.
You can script something like below.
var menuChild = mainMenu.FindAllChildren("ObjectType","link", 50, true); // Log the search results if (menuChild.length > 0) { for (i = 0; i < menuChild.length; i++) //For clicking
menuChild[i].Click();
//You can do your stuffs } else Log.Warning("No menu items found."); - FindAllChildren Method (Common for All Test Objects)