Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i check all the buttons are enabled or not using programming ?
#1
Not Solved Rolleyes 
HI ..
I am using a window based application .? NOw i want to check all the buttons whether all the buttons are enabled or not ? SO How can i check ?
Plseae send me script so that all the buttons are checked in a one time whether they are enabled or disabled ?
Reply
#2
Not Solved
Hi njnirmal,

Please check the below LOC. I have taken the Flight Reservation window.
'*******************************************************************
'*******************************************************************
Code:
Set chld=Description.Create
chld("micclass").value = "WinButton"
Set chldcln = Window("Flight Reservation").ChildObjects(chld)
msgbox chldcln.count
Flag = True
DisBut = 0
For num = 0 to chldcln.count-1
    'To highlight the button in the application
    chldcln(num).highlight
    If chldcln(num).GetRoProperty("enabled") <> True Then
        Flag = False
        DisBut = DisBut+1
    End If
Next
msgbox Flag
If Flag = True Then
    msgbox "All the Buttons in the window are enabled."
Else
    msgbox "In the Window" & "''" & DisBut & "'' buttons out of ''"& chldcln.count &"'' are disabled."
End If
'################
Object Release
'################
Set chld = Nothing
Set chldcln = Nothing
'*******************************************************************
'*******************************************************************

Please let me know if you need any more info.
Thanks,
SUpputuri
Reply
#3
Not Solved
Hi Guys,

The below script would also get you the result, but may not be compatible with all windows application as Iam filtering with the 'value' of Windows Style (which would vary from application to application"). Anyhow here it is............

=======================================
Code:
SystemUtil.Run "calc","","C:\Documents and Settings\Administrator",""

Set obj_AllButtonDesc = Description.Create
obj_AllButtonDesc("Class Name").value = "WinButton"
Set AllButtons = Window("Calculator").ChildObjects(obj_AllButtonDesc)
msgbox AllButtons.count

Set obj_DisButtonDesc = Description.Create
obj_DisButtonDesc("windowstyle").value = "1476395019"
Set DisabledButtons = Window("Calculator").ChildObjects(obj_DisButtonDesc)

msgbox DisabledButtons.count

If  AllButtons.count = DisabledButtons.count Then
    Msgbox( "All the buttons in your application are  currently enabled")
    Else
    Msgbox( "Few buttons in your application are currently disabled")
End If
=======================================
Reply
#4
Not Solved
Hi QTPgrd,

I belive the "windowstyle" property will differ from application to application. The script provided by QTPKing is correct.

Please let me know of your comments.

Thanks,
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT 12.52/VBScript] Test object exist, is visible and enabled before take an action sparkwanted 0 3,439 02-07-2017, 12:28 AM
Last Post: sparkwanted
  Identifying radio buttons with same html ID but dynamic webelement properties manishac 12 12,973 05-03-2012, 06:27 AM
Last Post: manishac
  QTP not identifying the TextArea and Buttons properly. vibhakhushi 0 2,240 02-22-2011, 11:32 PM
Last Post: vibhakhushi
Question How to check for a static text in a web page using desrciptive programming? jaykisan 4 5,421 12-03-2009, 10:13 AM
Last Post: Saket
  Button is not getting enabled estherindu 4 3,884 10-14-2009, 06:00 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)