Ask a Question

How to find the status of checkboxes on webpage window

sarya
Frequent Contributor

How to find the status of checkboxes on webpage window

Hi,



I am trying to verify the status of the checkboxes marked under options R,C,F as seen in screenshot . I am able to click on that with this code but somehow the status verification is not working. I tried CellObj.status and CellObj.checked but for both of them it is not able to find status and chekced property.What can I use to verify the checkbox status whether it is checked or not. Checbox enables property will not work as the checkbox under C and F are always enabled,i need to check whether they are checked or unchecked.



{

page3 = iexplore.Page("http://" + servername + ":" + port + "/" + r2wcontext + "/user.do*");

document = page3.document;

page3.NativeWebObject.Find("title","UserRead","A").Click();

all2 = document.all;

var cellText = "/UserRead";

var cellObj = GetNextCell(all2, cellText);

if (cellObj.status == "False")   //This is not working.

Log.Message("The content access for member is saved correctly","",pmNormal,Attr);

else

Log.Error("There is some error","",pmNormal,Attr);

}




function GetNextCell(allObj, cellText)

{

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

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

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

}



Thanks.


GetNextCell(allObj, cellText){ obj = allObj.FindChild("outerText", cellText); nativeCell = obj.parentNode.cells.item(2); allObj.FindChild("uniqueID", nativeCell.uniqueID);}Thanks.
13 REPLIES 13
sarya
Frequent Contributor

Hi Jared,



Another problem that I am facing is I can't use checkbox instead of the cell as the checkbox name changes everytime with the name of the folder that is selected .So thats why I am using cells .For example : in screenshot ,for the folder /UserRead the checkboxes name will be different than for any other folder that I select.So how can I address checkbox name directly instead of the cell .



Thanks,

Sumedha
YMinaev
Staff

Hi,



Enable the Tree or Hybrid model. Checkboxes will be children of table cells where they're located. You can obtain them by object type and text.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sarya
Frequent Contributor

Hey Jared,



I am using DOM as the tree model for web testing and it does not display tables and cells explicitly.Also I cannnot change it as all my scripts are based on this model only.



Thanks,

Sumedha
YMinaev
Staff

Hi,



Change the model to Hybrid. Your scripts will work without changes, and for certain objects (such as check boxes in table cells), you'll be able to use a more convenient way of access.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: