The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
SBsteve
Advanced Member


Reged: 05/11/07
Posts: 467
Loc: Dublin, OH USA
Verify checkbox status of node in WinTreeView
      #622687 - 04/16/10 07:52 AM

I want to do some web automation & testing with
IE 6.0 and QTP 9.2 using Java OFF then Java ON.
(The Java settings are in IE; Tools > Internet Options >
Advanced)

I did a quick record and playback using QTP, which worked fine.

Now here is the problem. When I get to the WinTreeView and I find the node that has the checkbox for Java ON/OFF (in the IE web browser), how can I check to see if it is checked or not?

I have spent almost 2 days on this issue. I have searched Google and have tried many things.

Two options I have tried so far is:

1. Check and see if the checkbox is checked or not by using GetItemProperty.

2. Force the checkbox to be unchecked, then later force it to be checked by using SetItemState.

Neither of these are working correctly.

When I just use the code from the basic QTP recording it used the Select command. Which selects the checkbox for the node under test. Problem is all that does it toggle it to the other state.
Ex: If the box is unchecked, the Select command will select it and vice-a-versa. That doesn't work because my script NEEDS to know what state the checkbox is in the first place before selecting it.

Any ideas??

Thanks,
SBsteve

Edited by SBsteve (04/16/10 07:56 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
gettext
Newbie


Reged: 02/19/08
Posts: 6
Re: Verify checkbox status of node in WinTreeView [Re: SBsteve]
      #622703 - 04/16/10 09:46 AM

Have QTP check the image index for the node. In your example, the tree control is implemented to use images to indicate checked or not.

If all else fails, there is probably a registry key somewhere that you could query.


Post Extras: Print Post   Remind Me!   Notify Moderator  
SBsteve
Advanced Member


Reged: 05/11/07
Posts: 467
Loc: Dublin, OH USA
Re: Verify checkbox status of node in WinTreeView [Re: gettext]
      #622711 - 04/16/10 10:08 AM

Great, could you elaborate a little more?

I will also search Google on what you suggested.

Thanks!
SBsteve


Post Extras: Print Post   Remind Me!   Notify Moderator  
gettext
Newbie


Reged: 02/19/08
Posts: 6
Re: Verify checkbox status of node in WinTreeView [Re: SBsteve]
      #622713 - 04/16/10 10:15 AM

one of the properties you can query using GetItemProperty is "imageindex". Try that one.

Post Extras: Print Post   Remind Me!   Notify Moderator  
SBsteve
Advanced Member


Reged: 05/11/07
Posts: 467
Loc: Dublin, OH USA
Re: Verify checkbox status of node in WinTreeView [Re: gettext]
      #622715 - 04/16/10 10:23 AM

Ok thanks "gettext". I will give that a try.

SBsteve


Post Extras: Print Post   Remind Me!   Notify Moderator  
SBsteve
Advanced Member


Reged: 05/11/07
Posts: 467
Loc: Dublin, OH USA
Re: Verify checkbox status of node in WinTreeView [Re: SBsteve]
      #622720 - 04/16/10 10:54 AM

Gettext,

You were right on the money! Thanks to you I now have the code. I will post it here for anyone else that can use it.

Everyone,

Please know that I change my object's names to make them more generic.

CODE
========================================================

'Want Java to be OFF
'Note: Java OFF = 1, Java ON = 0

State = 0
Do Until State = 1
SystemUtil.Run "iexplore.exe","","C:\Documents and Settings\Name\Desktop",""
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")

Print "State = " & State

'Check to see if Java is OFF or ON. If it is ON, turn it OFF.

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

Browser("ie_Generic").Dialog("dlg_InternetOptions").WinButton("btn_OK").Click
Browser("ie_Generic").Page("pg_Generic").Sync
Browser("ie_Generic").Close

'Now log back in if you had to set Java to OFF, to see if Java is indeed OFF before starting the test.

Loop

===========================================================

SBsteve


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
1 registered and 124 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 1876

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5