Skip to content

swfToolbar buttons – how to press/click

New Discussion
Janice
Janice asked on Apr 15, 2012 9:05 AM

Hello,

I need some guidance on how to click a button on a tool bar.  I can pull the button names but I am having a hard time with how to actually click a button.   Some advice would be great.

Here is what I have working:

strToolName = SwfWindow(“PRISM G2”).SwfToolbar(“_ProjectManagerWindow_Toolbars”).GetNAProperty (“Ribbon.Tabs[2].Groups[0].Tools[0]”)

print strToolName

result =  ‘ = [Cost Control Accounts] – ButtonTool

Cost Control Accounts is a button I would like to push to open another form.

 

Here are 3 different attemps:

SwfWindow(“PRISM G2”).SwfToolbar(“_ProjectManagerWindow_Toolbars”).ClickToolbarTool “_ProjectManagerWindow_Toolbars”, “Cost Control Accounts”

‘SwfWindow(“PRISM G2”).SwfToolbar(“_ProjectManagerWindow_Toolbars”).Press “_ProjectManagerWindow_Toolbars”, “Cost Control Accounts”

SwfWindow(“PRISM G2”).SwfToolbar(“_ProjectManagerWindow_Toolbars”).Press  (“Ribbon.Tabs[2].Groups[0].Tools[0]”)

Error from the last:

‘Cannot identify the specified item of the _ProjectManagerWindow_Toolbars object. Confirm that the specified item is included in the object’s item collection.

‘Line (87): “SwfWindow(“PRISM G2”).SwfToolbar(“_ProjectManagerWindow_Toolbars”).Press  (“Ribbon.Tabs[2].Groups[0].Tools[0]”)”.

Any help would be greatly appreciated.

 

 

Sign In to post a reply

Replies

  • 0
    Janice
    Janice answered on Aug 3, 2011 8:54 PM

    Here is the recorded action:

     

    SwfWindow("PRISM G2").SwfToolbar("_ProjectManagerWindow_Toolbars").PerformToolAction tbmgrRibbonTab, tbmgrClick, "Cost Management (Mar '11):Cost", "Cost Control Accounts"

    When running the line, it errors out.  Error:

    Object reference not set to an instance of an object.

    Line (82): "SwfWindow("PRISM G2").SwfToolbar("_ProjectManagerWindow_Toolbars").PerformToolAction tbmgrRibbonTab, tbmgrClick, "Cost Management (Mar '11):Cost", "Cost Control Accounts"".

    • 0
      Michael Germann
      Michael Germann answered on Oct 3, 2011 4:37 PM

      I have a feeling the install of TestAdvantage may have been slightly flawed. Try putting quotes around the tbmgrRibbonTab and tbmgrClick. The reason being, a number of releases ago, we started using QTP version of enumerations called ListOfValues. In the install it builds those ListOfValues for you and when QTP sees them they translate the values into Int16 values that we our methods understand. If that part of the install fails, then QTP sees the values like tbmgrRibbonTab and tbmgrClick as variables names that are not set, and when it attempts to send it to our actions it dies before it gets to us to throw a clean error message.

      Putting quotes around them is a simple test to see if that is the issue. The file not installed properly or not referenced properly is the TypeInformationFile called TestAdvantage.QTPServer.TypeInformation.xml. It needs to be either in a place where QTP knows where to look for the file or a registry entry that tells QTP to look in its current location.

         This behavior typically comes up on one of two occasions, a partial manual install where the step to add the registry entry was not done, or during a install scenario where QTP and TestAdvantage were installed back to back without running QTP at least once, before installing TestAdvantage. The help lists the steps to correct it in :

      Manually Setting Up TestAdvantage for Windows Forms (for HP QuickTest
      Professional software) step 4.

      • 0
        Anand
        Anand answered on Jan 5, 2012 4:58 AM

        Hi ,

        I want to select the menu.

        I am able to spy upto following hierarchy:

        SwfWindow("swfwin_PDMSDesign").SwfToolbar("swftb_PDMSDesign_Toolbar")

        If i want to select menu View ->Look , if am recording it then i am getting following code:-

        SwfWindow("swfwin_PDMSDesign").SwfToolbar("swftb_PDMSDesign_Toolbar").PerformToolAction tbmgrToolbar, tbmgrDropDown, "MainMenuBar", "!!APPDESMAIN.BAR.COREVIEWMENU"
        SwfWindow("swfwin_PDMSDesign").SwfToolbar("swftb_PDMSDesign_Toolbar").PerformToolAction tbmgrMenu, tbmgrDropDown, "MainMenuBar,!!APPDESMAIN.BAR.COREVIEWMENU", "!!APPDESMAIN.COREVIEWMENU.**11"

        I want to select menu by function.

        Please help me to know which methoda to use and which arguments to pass.

         

  • 0
    amitai
    amitai answered on Apr 9, 2012 8:10 AM

    I am having similar problems using UltraToolbarsDockArea in testadvantage version free, qtp11

    recording bring this code

     

    SwfWindow("MainReport").SwfToolbar(“MenuBar").PerformToolAction tbmgrToolbar, tbmgrDropDown, "MainMenu52", "3"

    SwfWindow("MainReport").SwfToolbar(“MenuBar").PerformToolAction tbmgrMenu, tbmgrDropDown, "MainMenu52,3", "13"

    SwfWindow("MainReport").SwfToolbar(“MenuBar").PerformToolAction tbmgrMenu, tbmgrClick, "MainMenu52,3,13", "19"

    but it does not replay

    are there any other methods?

    • 0
      amitai
      amitai answered on Apr 10, 2012 1:54 PM

      It turns out the code QTP recorded was not consistent and therefore didnt work, using  the value of the enum from TestAdvantage.QTPServer.TypeInformation.xml and the testadvantage help file, I was finally able to select using this code instead

      SwfWindow("MainReport").SwfToolbar(“MenuBar").PerformToolAction 103, 509, "MainMenu52", "3"

      SwfWindow("MainReport").SwfToolbar(“MenuBar").PerformToolAction 103, 509, "MainMenu52","3,13"

      SwfWindow("MainReport").SwfToolbar(“MenuBar").PerformToolAction 103, 503, "MainMenu52","3,13,19"

      Good luck

      • 0
        Michael S.
        Michael S. answered on Apr 12, 2012 1:50 PM

        I'm glad it works now.

      • 0
        Michael S.
        Michael S. answered on Apr 12, 2012 2:35 PM

        Amitai,

        I am going to try to reproduce this issue on my end.  Which version of TestAdvantage and NetAdvantage are you using?

      • 0
        amitai
        amitai answered on Apr 15, 2012 9:05 AM

        We have 10.3 CLR2 but are using the version free assemblies

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Janice
Favorites
0
Replies
8
Created On
Apr 15, 2012
Last Post
13 years, 10 months ago

Suggested Discussions

Tags

No tags

Created by

Created on

Apr 15, 2012 9:05 AM

Last activity on

Feb 23, 2026 4:32 PM