I am new to Test Advantage . I am using Test Advantage 7.3 with QTP 9.2
I am not able to click on menu.
I want to click on Close button on the top .
Swfwindow("PTM 2010.2 (8.0.0c)").SwfToolbar("_MainMDIForm_Toolbars_Dock_Are").
ClickToolbarTool "ToolbarsManager,Toolbars,ExcelUIToolbar","Close"
Attached is screen shot for .Net Spy and Application
I am not able to click on the Key inside the Toolbar . I am able to indentify that the Key exist inside the tool bar using the following code .
I am using Testadvance 2007 vol 3 clr2
set cToolbars = SwfWindow("PTM 2010.2 (8.0.0c)").SwfWindow("Open Contract").SwfToolbar("_pnlBottom_Toolbars_Dock_Area_").Object.ToolbarsManager.Toolbars
Set oMyTool = GetToolFromToolbar(cToolbars,"UltraToolbar1", "Go")
Function GetToolFromToolbar(byref cToolbars, sToolbarKey, sToolKey)
Dim oToolbar ' Toolbar object
Dim bToolbarFound
Dim bToolFound
bToolbarFound = false
bToolFound = false
msgbox cToolbars.Count
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
msgbox oToolbar.Tools.Count
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)
'oToolbar.Tools.ToolClick sToolKey
bToolFound = true
If bToolFound = false Then
Reporter.ReportEvent micFail, "Tool Not Found","Tool [" + sToolKey + "] not found in the Toolbar [" + sToolbarKey + "]"
Else
Reporter.ReportEvent micFail, "Toolbar Not Found", "Toolbar ["+sToolbarKey + "] not found in the collection supplied"
If bToolFound = true Then
' cToolbars.ClickNavToolbarTool "Go"
'oToolbar.Tools.ToolClick "Go"
Reporter.ReportEvent micPass, "Tool Found","Tool [" + sToolKey + "] found in the Toolbar [" + sToolbarKey + "]"
'Call ClickToolKey (sToolKey)
' cToolbars.ToolClick sToolbarKey,sToolKey
End Function
I have tried using method like
cToolbars.ClickToolbarTool "UltraToolbar1", "Go"
'cToolbars.ClickNavToolbarTool("Go")
I tried using ClickRibbonTool strMenu & ":" & strGroup , cToolbars. it worked fine for me. As the tools are present on groups and in turn present on a ribbon (which is a child obj for docArea).
It will work for sure.
Try using the below function:
cToolbars.ClickRibbonTool Menu & ":" & Group , cToolbars.Key