saguirre
5 years agoOccasional Contributor
Why does iterating through children seem to go in reverse order?
So I am doing testing of a React web application and I wanted to iterate through items in a drop-down list so that I can see if a specific item exists there. It seems like it's iterating through the children in reverse order. Why is that?
Here is a screenshot of my ObjectBrowser:
Here is the code that I am executing:
function findAndSelectAbsenceType(absenceType) {
var absenceTypePanel = NameMapping.Sys.browser.wfsPage.panelRoot.panel.panel.panel2.panel.panel.panel4.absenceTypePanel;
var dropDownListOfAbsenceTypes = NameMapping.Sys.browser.wfsPage.menuPanel.dropDownListOfAbsenceTypesPanel;
var i, child;
for (i = 0; i < dropDownListOfAbsenceTypes.ChildCount; i++)
{
child = dropDownListOfAbsenceTypes.Child(i);
Log.Message(i + " " +child.contentText + " " + child.Name, "", 0);
}
}
and here is a screenshot of the test results:
Any insights would be much appreciated?
Also, I did find this other post from a few years back that seems like it might be related:
Hi,
This is how tree traversing is implemented in TestComplete. You must not rely on indexes as static design-time identifiers, instead just as a means to distinguish between two otherwise identical objects.