Expand Node by Index instead of Text

3 posts, 1 answers
  1. Scott
    Scott avatar
    5 posts
    Member since:
    Nov 2014

    Posted 12 Nov 2014 Link to this post

    I recorded a test wherein I encountered a RadTreeView. I expand a parent node, then a child node, then the child's child node.

    When I execute the test it fails at the point where it attempts to expand the first node. It fails because it is searching for the text in the node but can't find it since the text of the node changes each time the test is run.

    So, I believe I need to have the test expand the nodes by index instead. Is there a setting that will accomplish this? Or can this only be solved by developing a coded step(s)?

    When it was recorded:
    RadTreeView('ctl00_ctl00_cphMain_rc_ProfileContent_rdTree_treePreferences'): 'CustomerA' action -> 'Expand'

    When the test ran:            
    RadTreeView('ctl00_ctl00_cphMain_rc_ProfileContent_rdTree_treePreferences'): 'CustomerB' action -> 'Expand'")]
  2. Scott
    Scott avatar
    5 posts
    Member since:
    Nov 2014

    Posted 13 Nov 2014 Link to this post

    As a solution to get me by for now, I'm querying the database for [$(UserName)], [$(CustomerName)], [$(ContractName)], to dynamically data-drive the test (each time the test runs, a different UserName/CustomerName/ContractName combo is used by selecting the TOP 1 row from a TABLESAMPLE).

    I'm not sure how brittle or solid this solution is. I need to figure out if it's searching each node for the data-driven variable until it finds it.....or if it's only looking in the first node (so far, each time I've run the test the selected variable has been in the first node).
  3. Answer
    Cody avatar
    3354 posts

    Posted 17 Nov 2014 Link to this post

    Hi Scott,

    No unfortunately there is no setting to select by index on the RadTree. Instead I suggest you disable the RadTreeView translator as shown in the attached screen shot, then re-record those steps. It will change the recording so that it clicks on the same expander element w/o regard for the text of that element. See the second screen shot for an example of the recording.

    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top