Click here to Skip to main content
13,901,221 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 6 Mar 2016
Licenced Ms-PL

Getting Started with Telerik Testing Framework C# in 10 Minutes

, 6 Mar 2016
Rate this:
Please Sign up or sign in to vote.
Brief tutorial how to start using one of the world best automation frameworks - Telerik Testing Framework. Exact steps to follow through a C# code.The post Getting Started with Telerik Testing Framework C# in 10 Minutes appeared first on Automate The Planet.


The Telerik Testing Framework exposes numerous properties and methods to help you easily build non-brittle, maintainable functional tests. It is cross-browser compatible. Expands your browser compatibility testing to all the latest major browsers: IE, Chrome, Firefox and Safari without ever changing your test case code. It also allows you to set implicit and explicit waits, test drag-n-drop and hovers, dynamic page elements, complex animations, generic and custom UI controls, and more. In our division, we are heavily using the framework. Personally, I believe that it has one of the richest Testing APIs on the market. Keep in mind that the Telerik Testing Framework is completely FREE (a list of key features).  Because I honestly believe that this framework can increase the quality of your automated tests, I am introducing a new series of blog posts dedicated to it. This is the first article in the series that will help you to get started. 

Create Your First Telerik Testing Framework Project

1. Download the Telerik Testing Framework

2. Install the Telerik Testing Framework

Telerik's browsers' clients are automatically installed in your install directory.

3. Create a new C# Unit Test Project in Visual Studio.

4. Select your project in the Solution Explorer in Visual Studio

5. Right-click the References folder displayed in the solution and select 'Add Reference'.

6. Navigate to the ArtOfTest.WebAii.dll installed on your machine in your %InstallDir%bin folder.

7. Select ArtOfTest.WebAii.dll

7. Click OK to finish adding the needed references.

Find even more detailed information in the official Getting Started with Telerik Testing Framework guide.

Telerik Testing Framework Basics C# Code

Configure the Testing Manager and Start a New Browser Instance

public class TelerikTestFrameworkGettingStarted
    private Manager manager;

    public void TestInitialize()
        Settings mySettings = new Settings();
        mySettings.Web.DefaultBrowser = BrowserType.FireFox;
        manager = new Manager(mySettings);

    public void TestCleanup()

    public void NavigateToAutomateThePlanet()

First, you need to create a new Settings instance, part of the ArtOfTest.WebAii.Core namespace. Through the WebSettings class exposed via the Web property, you can configure various settings regarding the web execution. After that, pass this object to the constructor of the WebAii Manager. Through the manager instance, you can control the entire test execution like starting, closing or maximizing browser instances. You can start a new browser instance using the LaunchNewBrowser method. You can set up a default browser, initializing the DefaultBrowser property. The Telerik Testing Framework's manager exposes an easy access to the current browser's instance through it property ActiveBrowser

Navigate to URL

Just use the NavigateTo method of the ActiveBrowser.

public void NavigateToAutomateThePlanet()

Advanced Web Settings

Set Default URL

Also, you can set up a default URL. When set NavigateTo should use a relative URL (e.g. "~/default.aspx").

manager.Settings.Web.BaseUrl = "";

Reuse Browser Instance

If you want to reuse the browser instance throughout the tests from the entire test class, you can set the RecycleBrowser property to true.

manager.Settings.Web.RecycleBrowser = true;

Kill Browser Process on Close

The KillBrowserProcessOnClose property gets or sets whether to make sure the browser process is killed when closing the browser.

manager.Settings.Web.KillBrowserProcessOnClose = true;

Note: Firefox is a single process browser. If you are using multiple browser instances and this setting is on, it will kill all open instances of Firefox.

Finding Page Elements

  • By ID
HtmlAnchor anchorById = manager.ActiveBrowser.Find.ById<HtmlAnchor>("uniqueId");
  • By Name
HtmlInputText textInputByName = 
  • By Class
HtmlDiv divByClass = manager.ActiveBrowser.Find.ByAttributes<HtmlDiv>("class=myclass");

Searches for an element using an 'exact' or 'partial' list of attribute values (You can specify 1-N attribute/value pairs).

  • By Content
HtmlSpan spanByContent = 
  "l:Automate The Planet", 

Searches for an element using 'exact', 'partial' or 'regex' of the element content. The element content can be: InnerText, InnerMarkup, OuterMarkup, TextConten.

  • 'l:' - signifies literal
  • 'p:' signifies partial
  • 'x:' signifies regular expression ("x:^(<tr>s*<tds*scope=.*>s*Education)")
  • By XPath
HtmlSelect selectByXpath = manager.ActiveBrowser.Find.ByXPath<HtmlSelect>("/html/body/select");
  • Find all By Tag name
IList<Element> allImages = manager.ActiveBrowser.Find.AllByTagName("img");
  • Find all by multiple criteria
var allElements = 
manager.ActiveBrowser.Find.AllByExpression("class=myclass", "textcontent=!Planet");

You can find more detailed information in the official Finding Page Elements Guide.

FindClauses With Operators

The key design goal for FindExpressions is to enable a flexible, rich and extensible search definition pattern. A FindClause is a name/value pair with an optional comparison operator. The optional operator is ALWAYS the first character after the = in the expression. This special character can be escaped with a preceding ' character if it is meant to be interpreted as a literal character.


Leading Character





Find the element where attribute foo 'contains' bar



Find the element where attribute foo 'does not contain' bar




Find the element where attribute foo 'starts with' bar



Find the element where attribute foo 'ends with' bar



Find the element where attribute foo 'matches the regular expression' ba* - See this link for a description of regular expressions.


'id=CenterDiv', '|',


Chains two expressions together. Chained expressions work by finding the element that matches the first expression, then underneath that find the element that matches the next expression. There is no technical limit to how many expressions can be chained together. The example tells Test Studio to find the first element whose ID = CenterDiv and then under that element find the third anchor element (tagIndex is 0 based).




Escape special characters. Find the element whose text = 'City', including the ' characters.




Find the element that has the specified attribute. Find the element that has the attribute 'foo'.




Find the element that does not have the specified attribute. Find the element that does not have the attribute 'foo'.


You can find more detailed information in the official HTML Find Expressions Guide.

HTML Element Actions in Telerik Testing Framework

For the examples I am going to use the well-known Automate The Planet's page- 'Awesome Healthy Menu Generator'.

public void TelerikTestStudioFrameworkBasicActions()
    HtmlInputSubmit generateButton = 
    HtmlInputCheckBox additionalSugarCheckbox = 
    HtmlInputText firstNameTextInput = 
    HtmlSelect burgersSelect = 
    HtmlInputRadioButton coffeeRadioButton = 
    manager.ActiveBrowser.Find.ByExpression<HtmlInputRadioButton>("value=^1 x Trenta");

    coffeeRadioButton.Check(true, true, true);
    burgersSelect.SelectByText("10 x Double Cheeseburgers");
    firstNameTextInput.Text = "Anton";
        isChecked: true, 
        invokeOnChange: true, 
        invokeOnClickChanged: true);
  • Check a Radio button
coffeeRadioButton.Check(isChecked: true, invokeOnChange: true, invokeOnClickChanged: true);
  • Select a Drop Down value
burgersSelect.SelectByText("10 x Double Cheeseburgers");
  • Type text in a Text Input
firstNameTextInput.Text = "Anton";
  • Check a Checkbox
    isChecked: true, 
    invokeOnChange: true, 
    invokeOnClickChanged: true);
  • Click a Submit button

HTML Element Asserts in Telerik Testing Framework

Telerik Testing Framework has a set of Assert classes to make validation of your HTML controls easier. You can verify a specified property of the control that it has a particular value or setting. If it doesn't have that setting/value an exception is thrown.

public void AssertRequiredFieldValidation()
    HtmlInputSubmit generateButton = 
    var requiredField = 

        "This is a required field");

You can find more detailed information in the official HTML Asserts Guide.


If you enjoy my publications, Get Instant Access to my future PRO tips and trips.


The post Getting Started with Telerik Testing Framework C# in 10 Minutes appeared first on Automate The Planet.

All images are purchased from and cannot be downloaded and used for free.
License Agreement


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

Anton Angelov
CEO Automate The Planet
Bulgaria Bulgaria
Anton Angelov is an IT Consultant and Quality Assurance Architect at Innovative Lab. He is passionate about automation testing and designing test harness and tools, having the best industry development practices in mind. In addition, he is an active blogger and the founder of Automate The Planet. He strives to make the site one of the leading authorities in Automation Testing by presenting compelling articles, inspiring ardent discussions amongst the community. He is also one of the most-rated-answer authors of questions about Test Automation Frameworks (WebDriver) on Stack Overflow.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190306.1 | Last Updated 7 Mar 2016
Article Copyright 2016 by Anton Angelov
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid