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

Is there a way to find and click a RadTreeView list item by some sort "text contains" method

1 Answer 64 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 2
Tim asked on 02 Feb 2015, 07:52 PM
I am trying to have a recorded test test click on an item in a RadTreeView list on a HTML webpage, in this case called "2. All Reservations".  But, the item title/name may not always contain the number "2." and may not be at the same index in the list, so I was hoping to find it and click it by the name "All Reservations". Here's more information below.

When I record the event in Test Studio, get the following entry (I replaced part of the navigation link with [some_code]):
RadTreeView('ctl00_ctrlMenu1_Menu'): '2. All Reservations ' action -> 'Navigate' to '/NewFormView.aspx?[some_code]'

Viewing the properties of the RadTreeNode, the html code is the following:
<div class="rtMid rtSelected rtHover">
<span class="rtSp"></span><a title="2. All Reservations" class="rtIn" href="NewFormView.aspx?[some_code]" target="_parent">2. All Reservations                     </a>
</div>

Editing the step in code, I receive the following (I replaced part of the navigation link with [some_code]):
'RadTreeView('ctl00_ctrlMenu1_Menu'): '2. All Reservations ' action -> 'Navigate' to 'NewFormView.aspx?[some_code]'
Pages.Home.CtrlMenu1MenuDiv.NavigateNodeByText("2. All Reservations ")

Is there a way for me to find the item by some sort of "text contains",  or is there another way of finding that element in a repeatable way?

Thanks,
Tim

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan Boev
Telerik team
answered on 05 Feb 2015, 07:57 PM
Hi Tim,

You can use chained find expression. In the first filter find the div which contains the link and the second filter should locate the link with TextContent "Contains" All Reservations.

See the attached screen shot.

You can achieve this also in code. You can find the container where the link is, then collect all links whiting this div in a list.

Iterate through this list and find the link with TextContent "Contains" All Reservations.

If you need further help please let us know.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Tim
Top achievements
Rank 2
Answers by
Boyan Boev
Telerik team
Share this question
or