Flanium 2.0.2.6
dotnet add package Flanium --version 2.0.2.6
NuGet\Install-Package Flanium -Version 2.0.2.6
<PackageReference Include="Flanium" Version="2.0.2.6" />
paket add Flanium --version 2.0.2.6
#r "nuget: Flanium, 2.0.2.6"
// Install Flanium as a Cake Addin #addin nuget:?package=Flanium&version=2.0.2.6 // Install Flanium as a Cake Tool #tool nuget:?package=Flanium&version=2.0.2.6
Flanium
Flanium is an all-purpose RPA Library created for Windows.
Flanium is made by joining two frameworks:
- Selenium - Selenium is a suite of tools for automating web browsers.
- FlaUi - FlaUI is a .NET library which helps with automated UI testing of Windows applications (Win32, WinForms, WPF, Store Apps, ...).
Flanium only supports Windows and Chrome browser for now. [12/08/2022]
Documentation can be found here.
Your very first web automation (a short tutorial on WebEvents)
First start off by opening Visual Studio (not Visual Studio Code) or maybe Jetbrains Rider, and create a Console Application in .NET 6 (Windows), then follow the instructions below.
The initializers in the Initializers library are dumb-proof, but you can make your own if you want, but these are generally the ones I would start with when making my web based RPA.
var chromeWeb = Initializers.InitializeChrome(Initializers.InitializeService);
This will create your Chrome browser with a plethora of useful arguments and other superpowers, it disables all of the logging that the base chromedriver has, so it leaves the console application open for writing without interruptions.
Now we have it open, then we would need to navigate to a webpage, let's choose https://www.codeproject.com/.
chromeWeb.Navigate().GoToUrl("https://www.codeproject.com/");
Then we want to click an element, I want to click the "Quick Answers" button on the homepage, I would do it like this:
WebEvents.Action.Click(chromeWeb,"//*[@id='ctl00_TopNavBar_Answers']");
That's it, now you've clicked the "Quick Answers" button.
Now perhaps I am curious about what text does the first answer have in the table that just appeared.
var answerText = WebEvents.Action.GetText(chromeWeb, "//*[@id='ctl00_ctl00_MC_AMC_Entries_ctl01_QuestionRow_H']");
I now have retrieved the text of the first question, for me it was "How do I pass variables from one PHP page to another".
Since I have all the information I need, I will now close the chrome session like this:
chromeWeb.Dispose();
And now we're done, our very first automation done easily.
Automatic Logging
All of the event libraries have built in logging for them, so you will see the results of the code in the Console Application.
Example:
The logging no longer looks like in the example image, but the general idea is the same.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-windows10.0.17763 is compatible. net7.0-windows was computed. net8.0-windows was computed. |
-
net6.0-windows10.0.17763
- DotNetSeleniumExtras.PageObjects (>= 3.11.0)
- DotNetSeleniumExtras.WaitHelpers (>= 3.11.0)
- FlaUI.Core (>= 3.2.0)
- FlaUI.UIA3 (>= 3.2.0)
- OpenPop.NET (>= 2.0.6.1120)
- Polly (>= 7.2.3)
- Selenium.Support (>= 4.4.0)
- Selenium.WebDriver (>= 4.4.0)
- Selenium.WebDriver.ChromeDriver (>= 104.0.5112.7900)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.