m0sk1t
12 years agoNew Contributor
FindAll and FindAllChildren doesn't work.
Hi! I'm using TestComplete v7.52.678.5 on MS Windows 7 Business 64-bit SP1. I'm trying to execute this code example from official JScript help:
function test() {
// Specify the sought-for property names
var PropArray = new Array ("ClassName", "WndClass", "Enabled", "Exists", "Visible");
// Specify the sought-for property values
var ValuesArray = new Array ("ToeFrame", "ToeFrame", true, true, true);
// Converts arrays
var prors = ConvertArray(PropArray);
var vals = ConvertArray(ValuesArray);
var StartObject = Sys.WaitProcess('fme',5000);
var frames = StartObject.FindAllChildren(prors, vals, 3, true);
}
function ConvertArray(AArray)
{
var objDict = new ActiveXObject("Scripting.Dictionary");
objDict.RemoveAll();
for (var j=0, l=AArray.length; j < l; j++)
objDict.Add(j, AArray);
return objDict.Items();
}
Array returned by FindAllChildren containing only undefined object, FindAll method also return undefined (see screenshot below). Converting to VBArray throws "Error: Could not convert variant of type (OleStr) into type (Dispatch)". Find method works correctly! How can i solve this problem?
RUS: в JScript не работают FindAll и FindAllChildren, есть ли какие-то особенности использования?
function test() {
// Specify the sought-for property names
var PropArray = new Array ("ClassName", "WndClass", "Enabled", "Exists", "Visible");
// Specify the sought-for property values
var ValuesArray = new Array ("ToeFrame", "ToeFrame", true, true, true);
// Converts arrays
var prors = ConvertArray(PropArray);
var vals = ConvertArray(ValuesArray);
var StartObject = Sys.WaitProcess('fme',5000);
var frames = StartObject.FindAllChildren(prors, vals, 3, true);
}
function ConvertArray(AArray)
{
var objDict = new ActiveXObject("Scripting.Dictionary");
objDict.RemoveAll();
for (var j=0, l=AArray.length; j < l; j++)
objDict.Add(j, AArray
return objDict.Items();
}
Array returned by FindAllChildren containing only undefined object, FindAll method also return undefined (see screenshot below). Converting to VBArray throws "Error: Could not convert variant of type (OleStr) into type (Dispatch)". Find method works correctly! How can i solve this problem?
RUS: в JScript не работают FindAll и FindAllChildren, есть ли какие-то особенности использования?
Hi,
The implementation of arrays in JScript requires the following conversion:
//...
var frames = StartObject.FindAllChildren(prors, vals, 3, true);
frames = VBArray(frames).toArray();