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
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.
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.
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.
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").SetFocusSwfWindow("SwIFT").SwfWindow("Share Services").SwfListView("_AvailableServicesUltraListVie").SetFocusSwfWindow("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").SetFocusSwfWindow("SwIFT").SwfWindow("Share Services").SwfButton("Change to Use Selected").ClickSwfWindow("SwIFT").SwfWindow("Share Services").SwfWindow("Action Confirmation").SwfObject("SwfObject").ClickButton msgbxYesSwfWindow("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
Awesome solution Alan!
Above solution works, we also had similar issue.
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!
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+1SwfWindow("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.