Forum Discussion

sarya's avatar
sarya
Frequent Contributor
13 years ago

'checked' property not being recongnised for an object in firefox

Hi,



I am trying to get checked property for a checkbox but it is not present in the test complete properties.



In the screenshot,I have captured the bigger checkbox and trying to get the checked property for the child of the bigger checkbox.The bigger checkbox firstChild is the checkbox to be clicked but it does not have checked property.How to find that?




function GetNextCell4Read_All(allObj, cellText)

{var obj = allObj.FindChild("innerHTML", cellText);

var nativeCell = obj.parentNode.cells.item(1);

return allObj.FindChild("innerHTML", nativeCell.innerHTML);

}



var cellText = "qa16";

var cellObj = GetNextCell4Read_All(all2, cellText);

Log.Message(cellObj.firstChild.checked);



Thanks,

Sumedha


GetNextCell4Read_All(allObj, cellText){ obj = allObj.FindChild("innerHTML", cellText);v nativeCell = obj.parentNode.cells.item(1); allObj.FindChild("innerHTML", nativeCell.innerHTML); } cellText = "qa16"; cellObj = GetNextCell4Read_All(all2, cellText);.Message(cellObj.firstChild.checked);Thanks,Sumedha

3 Replies

  • Hi,


    Your way to search for the needed check box seems to be incorrect. It looks like your function returns another object, not the needed check box. To check this, follow the steps below:


    1. Set a breakpoint on the Log.Message(cellObj.firstChild.checked); line.

    2. Run the test.

    3. When TestComplete pauses the test execution, open the Evaluate dialog and type cellObj into the Expression field. Then, click the Inspect button to explore the object. The ensuing Inspect dialog lets you inspect the object that is returned by your function and make sure that this is the needed check box and whether it has the checked property.

  • sarya's avatar
    sarya
    Frequent Contributor
    Hi ,



    I tried to evaluate and inspect .Also I saw in the object tree.The bigger box is Item("98") which does not have checked property ,but the checkbox appears as Item("access34Read") which is a checkbox and also has the checked property .Also Item("98") is the parent of Item("access34Read") .So what I am trying to do in my script is calling this code:


    var cellText = "qa16";

    var cellObj = GetNextCell4Read_All(all2, cellText);

    Log.Message(cellObj.firstChild.checked);



    ITem("98") firstChild property appears as [Text] and when I expand it ,it does not show any checked property. Then how to call the child of Item("98") to find the checked property.



    Thanks,

    Sumedha


    cellText = "qa16"; cellObj = GetNextCell4Read_All(all2, cellText);.Message(cellObj.firstChild.checked);ITem("98") firstChild property appears as [Text] and when I expand it ,it does not show any checked property. Then how to call the child of Item("98") to find the checked property.Thanks,Sumedha
  • Hi,


    Try to use the FindChild method instead of the firstChild method. For example:




    var checkBox = cellObj.FindChild("idStr","access34Read");

    Log.Message(checkBox.checked);