Micro Focus QTP (UFT) Forums
Check if the checkbox is checked or not? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Check if the checkbox is checked or not? (/Thread-Check-if-the-checkbox-is-checked-or-not)



Check if the checkbox is checked or not? - pjavvaru - 05-20-2010

Hi,

I have been trying this but did not find a solution by myself nor i could find in google.

when you goto--> IE brower-->Tools-->Internet options-->Advanced Tab-->Java(Sun)

There is a subitem under this java and i want to check if that checkbox is clicked.
When recording, it unchecks and checks which i dont want to do it.
I only want to check if it is not checked and if checked do nothing.

i tried this codeSystemUtil.Run "iexplore.exe
Code:
Browser("ie_Generic").WinToolbar("tb_ToolBar").Press "&Tools"
Browser("ie_Generic").WinMenu("wm_ContextMenu").Select "Internet Options..."
Browser("ie_Generic").Dialog("dlg_InternetOptions").WinTab("tb_SysTabCntrl").Select "Advanced"

Obj =  "Java (Sun);Use JRE 1.6.0_06 for <applet> (requires restart)"

State = Browser("ie_Generic").Dialog("dlg_InternetOptions").WinTreeView("tv_Settings").GetItemProperty(Obj, "ImageIndex")
If State = 0 Then
Browser("ie_Generic").Dialog("dlg_InternetOptions").WinTreeView("tv_Settings").Select "Java (Sun);Use JRE 1.6.0_06 for <applet> (requires restart)"
Browser("ie_Generic").Dialog("dlg_InternetOptions").WinButton("btn_Apply").Click
End If

I see that State has a value of empty no matter if that JRE 1.6.0.14 is checked or unchecked.

i tried using

Code:
State = Browser("ie_Generic").Dialog("dlg_InternetOptions").WinTreeView("tv_Settings").CheckItemProperty(item1,"selected",True)
Code:
State = Browser("ie_Generic").Dialog("dlg_InternetOptions").WinTreeView("tv_Settings").GetRoProperty("Checked")

nothing gives me a value all i get is empty.

Please help me as i tried a lot on this but i didnot get anything.

Thanks a lot


RE: Check if the checkbox is checked or not? - Saket - 05-20-2010

checking Image index using GetItemProperty should work in this case.
I suspect there must be some error with your object declaration, can you check the node in question again?


RE: Check if the checkbox is checked or not? - pjavvaru - 05-20-2010

Well, I feel i am right in my approach.
Let me know where exactly i am wrong
Obj is "Use JRE 1.6.0_14 <applet> requires restart"
This is under Java(Sun)
Follow the path i gave and you will find what i am trying to look for.
please find a solution, i see that many others tried on this and did not get far.

All i want to see is whether "Use JRE 1.6.0_14 is checked or not under Java(sun)

Follow this path for better understanding
IE brower-->Tools-->Internet options-->Advanced Tab-->Java(Sun)

i get state=empty
no matter if it is checked or unchecked.
i need a value so that i can verify. please help on this.

thanks
prasanna


RE: Check if the checkbox is checked or not? - Saket - 05-20-2010

well, I am not questioning on your approach, it is perfect here.
what I wanted to say to check whether you have used the proper Node text there in the below statement
Code:
Obj = "Java (Sun);Use JRE 1.6.0_06 for <applet> (requires restart)"

I can see in your post, you are pointing to "Use JRE 1.6.0_14 <applet> requires restart"
Just check if that is causing the issue.


RE: Check if the checkbox is checked or not? - pjavvaru - 05-27-2010

Hi saket,

You are right. i gave a little gap while spelling it and it didnot accept it. Now it works fine. Sorry for late reply. But i appreciate your concern. Thank you for taking great interest.

Prasanna


RE: Check if the checkbox is checked or not? - Demon31 - 11-28-2024

(05-27-2010, 06:49 PM)pjavvaru Wrote: Hi saket,

You are right. i gave a little gap while spelling it and it didnot accept it. Now it works fine. Sorry for late reply. But i appreciate your concern. Thank you for taking great interest.

Prasanna

HI pjavvaru can you reply on how to check whether the checkbox state is 'ON'  
In the properties there is nothing through which I can get the checked or 'ON' status.
I want to check for this webelement-

Browser("XXXXXXXXX").Page("Untitled Page_6").WebCheckBox("ctl00$ContentPlaceHolder1$togg").Set "ON"

suggestions?