Introduction to Fluent Automation

When try to automate any web application, will definitely look for a simple and powerful testing framework. Then can definitely consider this Fluent Automation to automate any web base application. It can be used with Selenium WebDriver C# and WatiN. Here going to discuss how to work with fluent automation with Selenium in the next blogs.

The purpose of fluent automation is, it is easy to learn API, Ability to share browser instances with single line of code, Ability to run tests on multiple browsers with single line of code and Very nice method chaining.

Will need a unit test framework as well. Can use either xUnit or NUnit or MSTest (the default in Visual Studio Test Projects) is also supported.

Once decided to use fluent automation and have your test framework ready, it is super easy to start testing with FluentAutomation. Just need to download the NuGet into Visual Studio to start with.

Your test classes need to inherit from “FluentAutomation.FluentTest” and call your provider's appropriate Bootstrap method. In most test frameworks will do this in the constructor of class. The Bootstrap method takes the browser target as an argument. You can pass multiple browsers if you would like to run the same test in each.


Basic Testing Knowledge
Basic automation Knowledge
Basic C# programming knowledge

Advantages of Fluent Automation:

Readability :

Let me take an example of Selenium as this tool is built on Selenium, if want to write something into any text box the syntax will be


Now let me write the same above statement with fluent C# style, the Syntax looks like below:


By just looking into the statement any person can easily understand what exactly the statement does.

Predefined Methods :

For each and every action in the fluent, there are predefined methods available as “Enter” is to enter the data into text box or text area, “Select” is select the data from the drop down and “TakeScreenshot” is to take the screenshot etc...

Method Chaining :

As the name indicate, can chain the methods without breaking the code i.e. once you initialize the “I” can write the methods without initializing the “I” again and again.
If have 3 text boxes and need to enter the data into the three textboxes using the method chaining, the the syntax will be:


Multi Browser Testing :

If want to test the same script with two or more browsers parallelly, just need to put a comma and mention the browse name to run the scripts in the multi browser.

Selenium Integration:

If badly stuck with fluent C# and not able to proceed as the intended option is not available with fluent C#, no worries, just can integrate with selenium and achieve the functionality.

Single line of coding :

In fluent C#, every functionality will be achieved by single line of code i.e. Selecting value from dropdown, switching to child window and drag and drop functionality etc… If want to achieve the same functionality with selenium need to write the multiple lines of code.

Limitations of Fluent Automation :

It works only with CSS Selectors
No Support as it is an open source
Cannot recognize Flash Objects

Example Program :

using FluentAutomation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassLibrary1
    public class HandlingBasicWebElements : FluentTest
        public void basicWebElements()
		// The below line Launch firefox Browser            
            // Below line navigate to the specified url
            // Entering some mail id into the textbox using locator
	      // Entering some data into the textbox using locator
            I.Enter("Fluent Automation Book").In("#tditma9>input");
      // Clicking on submit button
Selenium Tutorials: 


Your article to get started on the Fluent Automation is a good one. Covers the basic, can you also provide an example for integrating with Selenium Web Driver, that would be useful for many.

Test Name: LauchApp
Test FullName: TestWebApplication.Tests.Controllers.SampleTests.LauchApp
Test Source: d:\Projects\TestWebApplication\TestWebApplication.Tests\Controllers\SampleTests.cs : line 12
Test Outcome: Failed
Test Duration: 0:00:00.0488664

Result Message:
Test method TestWebApplication.Tests.Controllers.SampleTests.LauchApp threw exception:
System.IO.IOException: The process cannot access the file 'C:\Users\testuser.test\AppData\Local\Temp\chromedriver.exe' because it is being used by another process.

Unable to launch chrome browser because of this error.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.