Skip to content

Infragistics Community Forum / Test Automation For Micro Focus Uft Windows Forms / TreeView has a button that I need to click on in QTP

TreeView has a button that I need to click on in QTP

New Discussion
Rebecca
Rebecca asked on Jan 5, 2012 4:38 PM

In my QTP script, I need to be able to click on a button in a TreeView. I can access/activate  the cell it’s in:

SwfWindow(“SwIFT”).SwfTreeView(“_AttributesEditorUltraTree”).ActivateCell “\3\1”, “Value”

I asked the developer and he said I could do something like this:

_AttributesEditorUltraTree.Nodes[0].Cells[1].EditorResolved.ButtonsLeft[0].Click

to stimulate a click on the button.  This doesn’t work when I try it in QTP.

SwfWindow(“SwIFT”).SwfTreeView(“_AttributesEditorUltraTree”).Object.Nodes[“\3\1”].Cells[“Value”].EditorResolved.ButtonsLeft[0].Click

as I get a ‘Expected end of statement’ error.   What am I doing wrong?

 

Thanks,

Rebecca

 

Sign In to post a reply

Replies

  • 0
    Rebecca
    Rebecca answered on May 24, 2011 9:38 PM

    As a follow up, the developer told me that the EditorResolved (CellEditor) is an EmeddableEditorBase. For cells with buttons. it is an EmbeddableEditorButtonBase which contains 2 collections of EditorButton (ButtonsLeft and ButtonsRight).

     

    Hope this helps. Let me know if you need more information.

     

    • 0
      Michael S.
      Michael S. answered on May 25, 2011 10:07 PM

      Rebecca,

      This functionality is not available in TestAdvantage.  I am going to submit this as a feature request on your behalf.  You will receive more information on this through the support case.

      Michael S.

      • 0
        Alan Halama
        Alan Halama answered on May 27, 2011 6:00 PM

        Rebecca,

        Please provide me with more details on what the editor button does.  I am asking this because if the button only modifies the value of the editor, then the changes to the value of the cell should be recorded and could be played back.  Does that work in your application?  If so is this sufficient for testing your application?

        I am also looking into an approach for clicking the editor button and will follow up on that next week.

      • 0
        Rebecca
        Rebecca answered on May 27, 2011 8:23 PM

        It's more complicated than that. The button launches a dialog window where you select a service and then after clicking OK on that window, the value of the cell adjoining to it changes to that service.

        Here is what I have in my script. This is essentially what got recorded except of course for the commented out line.

         SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").SetFocus
             SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").Select "\Services\Customer Location Access1 (1332)"SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").ActivateCell "\3\1", "Value"

           'SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").Nodes("\3\1").Cells("Value").EditorResolved.ButtonsLeft(0).Click

        SwfWindow("SwIFT").SwfWindow("Share Services").SwfButton("Cancel").SetFocus
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfListView("_AvailableServicesUltraListVie").SetFocus
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfListView("_AvailableServicesUltraListVie").Activate "Customer Location  Access ([UNI Type],[Port Bandwidth]){951}"
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfListView("_AvailableServicesUltraListVie").SelectItems micNewSelection, "Customer Location  Access ([UNI Type],[Port Bandwidth]){951}"
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfButton("Change to Use Selected").SetFocus
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfButton("Change to Use Selected").Click
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfWindow("Action Confirmation").SwfObject("SwfObject").ClickButton msgbxYes
        SwfWindow("SwIFT").SwfWindow("Share Services").SwfButton("Change to Use Selected").SetFocus

        I had spoken with the developer about launching the dialog window separately but that  window needs the context of the button to update the value (the service selected)  in the right place.

         

        Thanks,
        Rebecca

      • 0
        Alan Halama
        Alan Halama answered on Jun 1, 2011 8:59 PM

        Rebecca,

        In a sample application that has an EditorButton in a text editor I was able to click the button with the following script:

        
        

        SwfWindow("Testing Trees").SwfTreeView("ultraTree1").Select "\ALABAMA"
        SwfWindow("Testing Trees").SwfTreeView("ultraTree1").ActivateCell "\0", "abbreviation"
        x = SwfWindow("Testing Trees").SwfTreeView("ultraTree1").GetNAProperty("ActiveCell.UIElement.ChildElements[0].ChildElements[0].Rect.X")
        y = SwfWindow("Testing Trees").SwfTreeView("ultraTree1").GetNAProperty("ActiveCell.UIElement.ChildElements[0].ChildElements[0].Rect.Y")
        SwfWindow("Testing Trees").SwfTreeView("ultraTree1").Click x +1, y+1
        SwfWindow("Testing Trees").Dialog("#32770").WinButton("OK").Click

        For your application please test the following three lines of code in the place where you have the commented line.  (After the call to ActivateCell) :

        
        

        x = SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").GetNAProperty("ActiveCell.UIElement.ChildElements[0].ChildElements[0].Rect.X")
        y = SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").GetNAProperty("ActiveCell.UIElement.ChildElements[0].ChildElements[0].Rect.Y")
        SwfWindow("SwIFT").SwfTreeView("_AttributesEditorUltraTree").Click x +1, y+1

        Note that if the above code doesn't work then I will need more details about the editor that is being used in the tree cell.

        Let me know if you have any questions with this matter.

      • 0
        Rebecca
        Rebecca answered on Jun 9, 2011 4:23 PM

        This work-around works well. Thanks!! Sorry- I thought I already replied last week.  I've already used it a couple of times for two different buttons.

         

        Thanks!

      • 0
        prashanth
        prashanth answered on Jan 4, 2012 10:32 AM

        Above solution works, we also had similar issue.

      • 0
        Tom Puglisi
        Tom Puglisi answered on Jan 5, 2012 4:38 PM

        Awesome solution Alan!

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Rebecca
Favorites
0
Replies
8
Created On
Jan 05, 2012
Last Post
14 years, 7 months ago

Suggested Discussions

Tags

Created by

Created on

Jan 5, 2012 4:38 PM

Last activity on

Feb 20, 2026 1:17 PM