Any sample selenium tests for dealing with tree view?

3 posts, 0 answers
  1. bill
    bill avatar
    4 posts
    Member since:
    Oct 2008

    Posted 13 Oct 2008 Link to this post

    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. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 14 Oct 2008 Link to this post

    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.
  3. bill
    bill avatar
    4 posts
    Member since:
    Oct 2008

    Posted 15 Oct 2008 Link to this post

    Many thanks I shall have a play with that.
Back to Top