Forum Discussion

iamraj09's avatar
iamraj09
Contributor
8 years ago
Solved

Unable to get the required object using FindChild method

Hello Everyone,

 

Currently we are testing a Android application, in which we are trying to get an object using findchild method. But we couldnt get the required object even after searching it in the depth of 7. Please suggest if this the right approach or any other things needed. Example code can be seen below. Please find the object and its properties in the attachments. 

 

 

function getRequiredChild(stringChildName)
{

        var processMotionSizer = Aliases["Device"]["ProcessMotionsizer"]["MotionSizerMainPage"];
        var arrayProperty = new Array("tagName","contextText");
        var arrayValue = new Array("LABEL",stringChildName);
        var objectRequiredChild = processMotionSizer["FindChild"](arrayProperty,arrayValue,7);

         return objectRequiredChild;

}

 

 

 

function getLabel(stringLabel)                                                            //@Param: stringLabel will be  "Type"
{
        var objectCombobox = getRequiredChild(stringLabel);
        if(objectCombobox!=EmptyObject)
        objectCombobox["Select"](0)["Touch"]();
        else
        Log["Error"]("ERROR:::");
}

  • var arrayProperty = new Array("tagName","contextText");  <--- maybe this typo causes the problem, should be contentText

3 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    var arrayProperty = new Array("tagName","contextText");  <--- maybe this typo causes the problem, should be contentText

    • iamraj09's avatar
      iamraj09
      Contributor

      Thank you !! ..That was a very silly mistake .. :)

      • baxatob's avatar
        baxatob
        Community Hero

        No problem. 95% of my own mistakes are typos in code :)