How to find the status of checkboxes on webpage window
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2010
02:06 AM
07-02-2010
02:06 AM
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);
}
GetNextCell(allObj, cellText){ obj = allObj.FindChild("outerText", cellText); nativeCell = obj.parentNode.cells.item(2); allObj.FindChild("uniqueID", nativeCell.uniqueID);}Thanks.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2010
11:51 PM
07-05-2010
11:51 PM
Hi,
You're using the status property incorrectly (comparing it with a string whose value is "False"). Look at this property in the Object Browser and check what values it has.
You're using the status property incorrectly (comparing it with a string whose value is "False"). Look at this property in the Object Browser and check what values it has.
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2010
06:32 AM
07-06-2010
06:32 AM
Hi Jared,
I checked the value for property "Status" and it has value as "False" when unchecked .Can you please tell me what else can I use to verify the checkbox state.
Thanks,
Sumedha
I checked the value for property "Status" and it has value as "False" when unchecked .Can you please tell me what else can I use to verify the checkbox state.
Thanks,
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2010
08:12 PM
07-06-2010
08:12 PM
Hi,
It is a boolean value, not a string. You need to use the boolean constant false in your code, not a string with the value "False".
It is a boolean value, not a string. You need to use the boolean constant false in your code, not a string with the value "False".
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2010
01:57 AM
07-09-2010
01:57 AM
Hi Jared,
If I see the property checked for the checkbox in this way as below,it shows the value as True .
If I see the property checked for the checkbox in this way as below,it shows the value as True .
"page3.document.all.Item("access67Read").checked"
But if I use it using cellObj like cellObj.checked ,it gives the error :Unable to find the object checked. So it is not recognising the cellObj.checked statement.But if I do this action as cellObj.Click ,it checks the checkbox correctly.
var cellObj = GetNextCell4Read(all2, cellText);
Thanks,
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2010
03:23 AM
07-12-2010
03:23 AM
Hi,
Most probably, you're trying to access the checked property which belongs to a wrong object. You need to use the check box, not the cell.
-----
Alexander
Customer Care Manager
Alexander
Customer Care Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2010
02:24 AM
07-13-2010
02:24 AM
Hi Alex,
var cellObj = GetNextCell4Read(all2, cellText);
cellObj.click() works fine.It clicks the correct checkbox ,then why is it not able to verify the checked property of the same checkbox.
Thanks,
Sumedha
var cellObj = GetNextCell4Read(all2, cellText);
cellObj.click() works fine.It clicks the correct checkbox ,then why is it not able to verify the checked property of the same checkbox.
Thanks,
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2010
07:51 PM
07-13-2010
07:51 PM
Hi,
The target check box is inside the cell. Try clicking on the cell manually - the check box will change its state since you hit it when clicking. But the cell object knows nothing about the check box state, you need to ask the check box about it directly.
The target check box is inside the cell. Try clicking on the cell manually - the check box will change its state since you hit it when clicking. But the cell object knows nothing about the check box state, you need to ask the check box about it directly.
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2010
07:39 AM
07-16-2010
07:39 AM
Hi Jared,
As per your reply:-
" The target check box is inside the cell. Try clicking on the cell manually - the check box will change its state since you hit it when clicking. But the cell object knows nothing about the check box state, you need to ask the check box about it directly."
I already have attached the screenshot.I am still not able to understand as how to check the state of the checkbox.Can you please tell me how to verify it and what property should be used to verify ?
Thanks,
Sumedha
As per your reply:-
" The target check box is inside the cell. Try clicking on the cell manually - the check box will change its state since you hit it when clicking. But the cell object knows nothing about the check box state, you need to ask the check box about it directly."
I already have attached the screenshot.I am still not able to understand as how to check the state of the checkbox.Can you please tell me how to verify it and what property should be used to verify ?
Thanks,
Sumedha
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2010
08:39 PM
07-18-2010
08:39 PM
Hi,
Use code like this:
Use code like this:
...
var checkbox = // Obtain your check box (the check box, not the cell in which it is located)
if(checkbox.state)
{
//checked
}
else
{
//unchecked
}
...
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
