This is a migrated thread and some comments may be shown as answers.

Any sample selenium tests for dealing with tree view?

2 Answers 868 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
bill
Top achievements
Rank 1
bill asked on 13 Oct 2008, 11:11 AM

Having trouble working this one out, below is the DOM view of my Tree view.

I need to search all 'li' elements within the whole tree for some text, then I need to click the "rtPlus" (+) element inside the the li element that contains the matched text.

div id="TreeView1" class="RadTreeView RadTreeView_Default explorertree>
        <ul class="rtUL rtLines">
                <li class="rtLI rtFirst">
                <li class="rtLI">
                <li class="rtLI">
                        <div class="rtMid">
                        <span class="rtSp"/>
                        <span class="rtPlus"/> **click this when test matched **
                        <img class="rtImg">
                        <span class="rtIn">
                                #text **This is the matching text**
                <li class="rtLI">
                <li class="rtLI">
                <li class="rtLI">
                <li class="rtLI rtLast">

I'm sure that this can be done with a single XPath query to locate the correct "rtPlus" button and would really appreciate someone suggesting the right approach to this or some sample selenium tests for this component would be good.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 14 Oct 2008, 07:31 AM
Hi Bill,

I suggest you use the client-side api of RadTreeView to find the node which matches the text and then expand it. See the sample test below:

<tr> 
    <td>openAndWait</td> 
    <td>http://demos.telerik.com/aspnet/prometheus/TreeView/Examples/Functionality/Whatsnew/DefaultCS.aspx</td> 
    <td></td>  
</tr> 
<tr> 
    <td>storeEval</td> 
    <td>this.browserbot.getCurrentWindow().$find('RadTreeView1')</td> 
    <td>tree</td> 
</tr> 
<tr> 
    <td>getEval</td> 
    <td>storedVars["tree"].findNodeByText("Zanzibar").expand()</td> 
    <td></td>  
</tr> 

It expands the node with text "Zanzibar".

Hope this helps.

Kind regards,
Helen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
bill
Top achievements
Rank 1
answered on 15 Oct 2008, 07:36 PM
Many thanks I shall have a play with that.
Tags
TreeView
Asked by
bill
Top achievements
Rank 1
Answers by
Helen
Telerik team
bill
Top achievements
Rank 1
Share this question
or