Automating RadTab Items

3 posts, 1 answers
  1. Joe
    Joe avatar
    2 posts
    Member since:
    Jun 2012

    Posted 29 Jun 2012 Link to this post

    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. Answer
    Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 29 Jun 2012 Link to this post

    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
  3. Joe
    Joe avatar
    2 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    Thanks Anthony, that worked. Thanks for your help.
Back to Top