Forum Discussion

bhaugurav's avatar
bhaugurav
Occasional Contributor
14 years ago

Having problems in WPF TreeView control.

I have WPF TreeView control. When I record actions on Treeview it shows index like this

treeview.ClickItem("|[0]|[0]|[0]"). 

    I dont find the way to give actual path for this.e,g. C:\Data so that I can give ClickItem("|C:|Data").

Also there is no action recorded for expanding node. Also I can find Expand collapse method for wItem, but not for Items.

What is difference between this two? Any help/clue will be appreciated.



Thanks,

Bhausaheb Gurav

5 Replies

  • Hi,


    First of all, please note that you can input the needed path directly into an edit box of your application (I suppose that there should be an edit box containing the selected path in the window). Also, if your application uses a standard Windows file/folder selection dialog, you should use the OpenFile method to open the file/folder located by the mentioned path.




    I dont find the way to give actual path for this.e,g. C:\Data so that I can give ClickItem("|C:|Data").



    The tree node can be accessed by using nodes' captions as well:




    treeview.ClickItem("|C:|Data");



    where 'C:' is the root, and 'Data' is its child node. For more information, refer to the 'ClickItem Action (TreeView Controls)' help topic . Does it work?




    there is no action recorded for expanding node



    We tried to record the expanding action over the WPF TreeView sample from the Windows Client .Net site: the action was recorded successfully.

    Please provide us with the recorded script so we can try to investigate the issue. Also, tell us the ClrFullClassName property value and version of the control you are testing.




    I can find Expand collapse method for wItem, but not for Items. What is difference between this two?



    The first one provides you with access to a collection of tree view items, the second - to individual items of the tested control. For more information, refer to the 'wItems Property (TreeView Controls)' and 'Item Property (TreeViewItemCollection Objects)' help topics.


    You can also use the ExpandItem method for your WPFTreeView.

  • bhaugurav's avatar
    bhaugurav
    Occasional Contributor
    Hi ,

    Sorry for late reply.

    Please find details below:

    1. I am using WPF TreeView which we have for selecting data for backup software. So there is no any editbox and I cant use any OpenFile method(I assume this will clarify the thing)



    2. Below is the script I recored with our product TreeView

        

    Call treeView.ClickItem("|[0]|[0]|[3]") //Expand Action


    Call treeView.ClickItem("|[0]|[0]|[3]|[0]") //Expand Action


    treeView.WPFObject("TreeViewItem", "", 1).WPFObject("TreeViewItem", "", 1).WPFObject("TreeViewItem", "", 4).WPFObject("TreeViewItem", "", 1).WPFObject("DockPanel", "", 1).WPFObject("Button", "", 1).ClickButton  //Selected the node(checkBox )



    3. I tried ClickItem method you suggested like this

    Call treeView.ClickItem("||[Data]|[ABC]") where my path hierarchy is C:\Data\ABC, but it is giving erros as "control item C not found".



    I am stcked :( . Any solution???



    Thanks,

    Bhausaheb Gurav



  • Hi,




    3. I tried ClickItem method you suggested like this

    Call treeView.ClickItem("||[Data]|[ABC]") where my path hierarchy is C:\Data\ABC, but it is giving erros as "control item C not found".



    Add a colon after 'C' and remove square brackets as they are not used when addressing by captions:




    Call treeView.ClickItem("|C:|Data|ABC")


    If this suggestion does not help, please zip your entire project suite folder along with the log of the failed test execution and send us the archive via our Contact Support form (http://www.automatedqa.com/support/message). Make sure that messages in your log correspond to the latest version of your tests. Also, please let us know the value of the ClrFullClassName property of the problematic tree control.