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

Automating RadTab Items

2 Answers 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 29 Jun 2012, 01:54 PM
Hello,

I want to click on a RadTabItem in my automation, but have no idea how to go about doing this.

<!--Manufacturer Tab-->
           <telerik:RadTabItem DropDownContent="Manufacturers" Header="Manufacturers" FontSize="14" Background="Transparent" Padding="20,0,20,0">
               <telerik:RadTabItem.Content>
               .
               .
               .                    
               .                        
               </telerik:RadTabItem.Content>
           </telerik:RadTabItem>

2 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 29 Jun 2012, 04:31 PM
Hello Joe,

The easiest way is to identify the TabItem's child TextBlock by TextContent, then click the parent TabItem:

SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
  
TextBlock tb = app.Find.ByTextContent("Telerik").As<TextBlock>();
RadTabItem rti = tb.Parent<RadTabItem>();
rti.User.Click();

Or you can place the parent RadTabControl into a variable (rtc in the example below) and access a RadTabItem by index:

IList<RadTabItem> list = rtc.Find.AllByType<RadTabItem>();
RadTabItem rti2 = list[3].As<RadTabItem>();
rti2.User.Click();


Greetings,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Joe
Top achievements
Rank 1
answered on 03 Jul 2012, 01:29 PM
Thanks Anthony, that worked. Thanks for your help.
Tags
General Discussions
Asked by
Joe
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Joe
Top achievements
Rank 1
Share this question
or