Automation of the .NET ToolbarsManager
If you use QTP for automating .NET apps and the app is built using infragistics, you know that it is not easy to use the .NET spy . After a lot of effort I was able to find solution to perform operations on a infragistics toolbar where the swftoobar object was getting identified as a swfobject:
Here is the code how to work with .net toolbarsmanager:
And if you are lucky that the toolbar is recognized as swftoolbar then its easier:
set obj = SwfWindow("SwfWindow").SwfToolbar("SwfToolbar").Object.Buttons
msgbox obj.Count
For i = 1 to obj.Count
msgbox obj.Item(i).tooltiptext // or any other operation
Next
Here is the code how to work with .net toolbarsmanager:
set cToolbars = SwfWindow("").SwfObject("").Object.ToolbarsManager.Toolbars
Set oMyTool = GetToolFromToolbar(cToolbars,"", "")
omyTool. 'Operation you want
Function GetToolFromToolbar(byref cToolbars, sToolbarKey, sToolKey)
Dim oToolbar ' Toolbar object
Dim bToolbarFound
Dim bToolFound
bToolbarFound = false
bToolFound = false
For x = 0 to cToolbars.Count - 1
If sToolbarKey = cToolbars.GetItem(x).Key Then
set oToolbar = cToolbars.GetItem(x)
bToolbarFound = true
Exit for
End If
Next
If bToolbarFound = true Then
For x = 0 to oToolbar.Tools.Count - 1
If sToolKey = oToolbar.Tools.GetItem(x).Key Then
Set GetToolFromToolbar = oToolbar.Tools.GetItem(x)
bToolFound = true
Exit for
End If
Next
If bToolFound = false Then
msgbox"Tool Not Found"
End If
End If
End Function
Set oMyTool = GetToolFromToolbar(cToolbars,"", "")
omyTool. 'Operation you want
Function GetToolFromToolbar(byref cToolbars, sToolbarKey, sToolKey)
Dim oToolbar ' Toolbar object
Dim bToolbarFound
Dim bToolFound
bToolbarFound = false
bToolFound = false
For x = 0 to cToolbars.Count - 1
If sToolbarKey = cToolbars.GetItem(x).Key Then
set oToolbar = cToolbars.GetItem(x)
bToolbarFound = true
Exit for
End If
Next
If bToolbarFound = true Then
For x = 0 to oToolbar.Tools.Count - 1
If sToolKey = oToolbar.Tools.GetItem(x).Key Then
Set GetToolFromToolbar = oToolbar.Tools.GetItem(x)
bToolFound = true
Exit for
End If
Next
If bToolFound = false Then
msgbox"Tool Not Found"
End If
End If
End Function
set obj = SwfWindow("SwfWindow").SwfToolbar("SwfToolbar").Object.Buttons
msgbox obj.Count
For i = 1 to obj.Count
msgbox obj.Item(i).tooltiptext // or any other operation
Next
What method i hav to used to click on a menu eg File->window new
ReplyDeleteI hav tried select, click but not working...
regards
Is the toolbar getting recognized as swftoolbar?
ReplyDeleteIn that case something like this should work:
SwfWindow("").SwfToolbar("").Select "File;New"
If not do u have shortcuts assigned to your menu , you can use them using sendkeys or :
SwfWindow("").Type micAltDwn + "c" + micAltUp
SwfWindow("").SwfToolbar("").ClickToolbarTool "MenuBar","File"
SwfWindow("").SwfToolbar("").ShowDropdown ""
No its a swfobject....is there is any methods is availiable to click on a menu eg as suggested by u...oMytool.select.
ReplyDeleteAlso we don't hav any short cut key to access the menu items....
ReplyDeleteSorry about the late reply was a lil busy, If you havent solved ur issue, here is the soln:
ReplyDeleteSet Mnubar = SwfWindow("").SwfObject("").Object.CommandLinks
For i = 0 To Mnubar.Count -1
Mnuname=Mnubar.Item(i).Text
msgbox Mnuname
oBounds = Mnubar.Item(i).Bounds
arrBounds = Split(oBounds, ",")
arrBound = Split(arrBounds(0), "=")
iX = CInt(arrBound(1))
arrBound = Split(arrBounds(1), "=")
iY = CInt(arrBound(1))
SwfWindow("").Activate
SwfWindow("").SwfObject("").Click iX,iY
Thanks for your Reply...
ReplyDeleteMy toolbar is of control-Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
I have tried your code but commandlinks method is not populated bec of which i am unable to apply the same.
regards
Try the soln frm the below link and let me know how far you go with it:
ReplyDeletehttp://www.advancedqtp.com/knowledge-base/articles/environment-techniques-id15/net-id173/exploring-custom-controls/
cheap jordans
ReplyDeletekobe
bape clothing
jordan shoes
yeezy boost
kd shoes
golden goose
longchamp
lebron 15
supreme clothing
vacdiaPstannu Samantha Lozano Crack
ReplyDeleteplanbadmahea