VisionAutomationFramework 3.3.0
dotnet add package VisionAutomationFramework --version 3.3.0
NuGet\Install-Package VisionAutomationFramework -Version 3.3.0
<PackageReference Include="VisionAutomationFramework" Version="3.3.0" />
<PackageVersion Include="VisionAutomationFramework" Version="3.3.0" />
<PackageReference Include="VisionAutomationFramework" />
paket add VisionAutomationFramework --version 3.3.0
#r "nuget: VisionAutomationFramework, 3.3.0"
#:package VisionAutomationFramework@3.3.0
#addin nuget:?package=VisionAutomationFramework&version=3.3.0
#tool nuget:?package=VisionAutomationFramework&version=3.3.0
Vision Automation Framework (VAF)
VAF is a fluent test automation framework for .NET on top of Selenium WebDriver. Waiting for the page, for elements to be visible and interactable is handled for you, so tests read like the steps they describe.
Upgrading from 2.x: see Migrating from 2.x.
Requirements
- A test project for .NET Framework 4.7.2 (or newer 4.x) or .NET 10. .NET 8 and 9 are not
supported: the build stops with error
VAF0001. - Any test framework: NUnit 3 or 4, MSTest, xUnit. VAF does not depend on one.
- Google Chrome, Firefox, or Safari on macOS. Selenium Manager downloads the matching browser driver on the first run, no driver package needed.
- Tested with Chrome and Firefox on Windows. Linux and macOS on .NET 10 are supported by design but not yet tested.
Installation
dotnet add package VisionAutomationFramework
- NuGet picks the lowest Selenium VAF allows (4.45.0). For a newer one, add
Selenium.WebDriverandSelenium.Supportto your project yourself, both with the same version; VAF works with any 4.x from 4.45. - In an old-style project (
packages.config), install through Manage NuGet Packages, so the references toSelenium.WebDriverandSelenium.Supportare added too; a hand-written HintPath to VAF alone does not bring them.
Quick start
using NUnit.Framework;
using VisionAutomationFramework;
using VisionAutomationFramework.Browsers;
using VisionAutomationFramework.Extensions;
public class Tests
{
[Test]
public void OpensExampleDomain()
{
var browser = Testing.On<Chrome>();
try
{
browser.LetsNavigateTo("https://example.com/")
.Should().HaveTitle("Example Domain");
}
finally
{
browser.Scope.Driver.Quit();
}
}
}
With MSTest or xUnit the test is the same, only the attributes differ ([TestMethod], [Fact]).
A failed check throws VafAssertionException, which every test framework reports as a failed test:
VisionAutomationFramework.VafAssertionException : Title on active tab isn't correctly populated
Expected: "Wrong title"
But was: "Example Domain"
The full guide is at https://www.visionautomationframework.com/quick-start-guide.
Settings
Each setting is read from the environment variable VAF_<name> first, then from appSettings in
the test project's app.config. Environment variables also work on .NET 10, where app.config often
does not reach the test run, and in CI.
| Setting | Default | Meaning |
|---|---|---|
ElementWaitTimeout |
10 | Seconds to wait for an element |
LoaderWaitTimeout |
60 | Seconds to wait for a loader to disappear |
DownloadDirectory |
c:\mydownloads on Windows, <temp>/vaf-downloads elsewhere |
Where Chrome and Firefox save downloads |
ChromeArguments |
none | Extra Chrome arguments, separated by spaces; quote one that contains spaces |
FirefoxArguments |
none | Extra Firefox arguments, as above |
Browser options
To change the options VAF creates for Chrome, ChromeProxy or Firefox, set a delegate once,
e.g. in [AssemblyInitialize] or [OneTimeSetUp]. Testing.On<Chrome>() stays as it is:
BrowserOptions.ConfigureChrome = options => options.AddArgument("--window-size=1600,900");
Testing.On<Chrome>();
It runs after VAF's own options and the ChromeArguments setting, right before the driver
starts, for every browser started afterwards. It can add options, not remove VAF's; for full
control create your own IBrowserDefinition and start it with Testing.On(browser).
Chrome also starts when the test runs as administrator (e.g. Visual Studio run as admin). Chrome then runs with admin rights, so prefer running tests without them.
What's new in 3.3
More fixes found by the regression suite. As in 3.2, a test that relied on a wrong result can start to fail.
- Date pickers (
AsDateTimeFlatpickerV4,AsDateTimeBootstrap3DatepickerV4) work on a machine with non-English regional settings. Day, month and AM/PM are looked up in English, as the calendars show them, andHaveValue(date, format)formats the expected date with the invariant culture. Before, a German machine looked for "Oktober 5, 2026" and expected "05.10.2026" forMM/dd/yyyy. - The flatpickr day and AM/PM are clicked with VAF's click, which scrolls and tries again when they are covered (e.g. a calendar at the bottom of the window).
LetsSelectOptionFromRightClickMenuwaits for the browser's menu before it presses the keys.AsSlideBar().Should().HaveValue("73")works. Before, the check could not be called (the class was internal) and threwNotImplementedException.
What's new in 3.2
Fixes found by VAF's new regression suite. A test that relied on the wrong result can start to fail; in each case the old result was wrong.
Should().HaveAlert()waits for the alert (as long asElementWaitTimeout), so an alert that opens a moment after the click is found.AsPane().Should().HaveValue()compares the pane's text, the valueLetsGetValue()returns. Before, it compared theNameattribute.IsVisible()isfalsefor a hidden element.LetsCheckIfWindowExists()stays on the current window.LetsSwitchToWindow(title)andLetsSwitchToWindowByURL()that find nothing go back to the window the test was on.- New:
AsSection()on an element found withHaveElement, e.g. to count the items of a list.
What's new in 3.1
- Chrome also starts when the test runs as administrator (e.g. Visual Studio run as admin). Before,
Chrome relaunched itself without admin rights and the driver failed with
session not created: Chrome instance exited. BrowserOptions.ConfigureChromeandBrowserOptions.ConfigureFirefox, and the settingsChromeArguments/FirefoxArguments, add browser options whileTesting.On<Chrome>()stays as it is. See Browser options.- 3.1.1:
Should().NotHaveElement<T>()on a section passed even when the element was visible. It now fails in that case, as it already did on a page. A test that relied on the wrong result can start to fail: the element it checks is really there.
What's new in 3.0
- .NET 10 alongside .NET Framework 4.7.2, with the same API.
- No test framework dependency. Works with NUnit 3 and 4, MSTest and xUnit. Under MSTest the
TestExecutionContext.IsolatedContextworkaround is no longer needed. - Only Selenium as a dependency (Selenium.WebDriver and Selenium.Support 4.45 or newer 4.x; on .NET 10 also System.Configuration.ConfigurationManager, for app.config).
- Settings from environment variables (
VAF_ElementWaitTimeout, …) or app.config, and a newDownloadDirectorysetting. LetsSaveScreenshotTo(directory, fileName)saves a screenshot anywhere and returns the path, so you can attach it in any test framework.LetsTakeScreenshot()still saves it in the NUnit test directory and attaches it to the NUnit result.LetsSelectOptionFromRightClickMenurefuses to send keys when the browser is not the foreground window, instead of typing into another window. Do not run such tests in parallel. Firefox started from a test run usually does not get the foreground on Windows, so with Firefox this method mostly refuses; it works with Chrome.Testing.On(browser)for a browser you create with settings, e.g. a remote grid or extra arguments:Testing.On(new MyRemoteChrome(gridUrl)).Testing.On<Chrome>()stays for browsers without settings.AndAlso()also after a check, so several checks on one section stay in one chain:.AsLabelText().Should().HaveValue("…").AndAlso().Should().HaveElement<Next>()…- HTML reports are named
VAF_Log_<test name>_<yyyy-MM-dd_HH-mm-ss>.html, so tests that finish in the same minute no longer overwrite each other's report (2.x:VAF_Log_<hh-mm MM-dd-yyyy>.html).
Migrating from 2.x
Most tests recompile unchanged. Check these points:
| 2.x | 3.0 |
|---|---|
| VAF brought NUnit, Newtonsoft.Json and RestSharp into your project | Only Selenium. If your tests use NUnit, Newtonsoft.Json or RestSharp, reference them yourself. |
Failed checks threw NUnit's AssertionException |
They throw VisionAutomationFramework.VafAssertionException. Change catch (AssertionException) in your code. |
LetsTakeScreenshot(TestContext tc, …) with the MSTest v1 TestContext |
var path = browser.LetsSaveScreenshotTo(TestContext.TestResultsDirectory); then TestContext.AddResultFile(path); |
BrowserStack: Testing.On<T>(browserStackOptions), BrowserStackRemoteWebDriver, BrowserStackExtensions, IOSSafari, MobileRemoteDriver, MobileDevice |
Removed (obsolete since 2.1). For a remote grid, implement IBrowserDefinition returning a Selenium RemoteWebDriver, and start it with Testing.On(new YourRemoteBrowser(options)). |
Mobile types: MobileAppActions, MobileAppAssertions, ActionsMobileApp<T>, AppScope, IMobileContext, MobileApp, non-generic ButtonActions / ButtonAssertions |
Removed. They could not be used: there was no way to start a mobile session. |
WinFormApplication, InternetExplorer |
Removed (the first was never implemented; Internet Explorer is retired). |
WebElementAssertionMethods in the global namespace |
In VisionAutomationFramework.Extensions. |
MSTest: new NUnit.Framework.Internal.TestExecutionContext.IsolatedContext(); in [TestInitialize] |
Not needed; remove it. |
Features
- Chrome, Firefox and Safari; your own browsers through
IBrowserDefinition - Pages, sections and elements as small classes with one locator each
- Element-specific actions and assertions (
AsButton(),AsTextInputField(),AsLabelText(), …) - Built-in waits and loader handling
- XML test log with an HTML report
Contact
https://www.visionautomationframework.com/contact
License
MIT — see LICENSE.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- Selenium.Support (>= 4.45.0 && < 5.0.0)
- Selenium.WebDriver (>= 4.45.0 && < 5.0.0)
-
net10.0
- Selenium.Support (>= 4.45.0 && < 5.0.0)
- Selenium.WebDriver (>= 4.45.0 && < 5.0.0)
- System.Configuration.ConfigurationManager (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 3.3.0 | 110 | 10/21/2026 | |
| 3.2.0 | 95 | 10/20/2026 | |
| 3.1.1 | 93 | 10/20/2026 | |
| 3.1.0 | 93 | 10/20/2026 | |
| 3.0.0 | 111 | 10/1/2026 | |
| 3.0.0-beta.3 | 68 | 9/30/2026 | |
| 3.0.0-beta.2 | 76 | 9/28/2026 | |
| 3.0.0-beta.1 | 95 | 9/27/2026 | |
| 2.1.0 | 107 | 9/27/2026 | |
| 2.0.30 | 406 | 4/7/2025 | |
| 2.0.29 | 336 | 4/7/2025 | |
| 2.0.28 | 274 | 11/19/2024 | |
| 2.0.27 | 285 | 10/28/2024 | |
| 2.0.24 | 274 | 7/29/2024 | |
| 2.0.23 | 320 | 5/29/2024 | |
| 2.0.22 | 307 | 5/29/2024 | |
| 2.0.21 | 309 | 5/28/2024 | |
| 2.0.20 | 328 | 5/16/2024 | |
| 2.0.19 | 577 | 1/4/2024 | |
| 2.0.18 | 711 | 10/26/2023 |
3.3.0: More fixes found by the regression suite; a test that relied on the wrong result can start to fail. Date pickers (flatpickr, Bootstrap 3) work on machines with non-English regional settings: day, month and AM/PM are looked up in English and HaveValue formats the expected date with the invariant culture (before, e.g. "Oktober 5, 2026" or "05.10.2026"). The flatpickr day and AM/PM are clicked with VAF's click, which scrolls and retries when they are covered. LetsSelectOptionFromRightClickMenu waits for the browser's menu before the key presses. AsSlideBar().Should().HaveValue() works (the assertion class was internal and HaveValue threw NotImplementedException). 3.2.0: Fixes found by the new regression suite; a test that relied on the wrong result can start to fail. HaveAlert() waits for the alert (ElementWaitTimeout) instead of taking it at once. AsPane().Should().HaveValue() compares the text, as LetsGetValue() returns it, not the Name attribute. IsVisible() is false for a hidden element. LetsCheckIfWindowExists() stays on the current window, and a LetsSwitchToWindow / LetsSwitchToWindowByURL that finds nothing goes back to it. New: AsSection() on an element found with HaveElement. 3.1.1: Fix: Should().NotHaveElement<T>() on a section passed even when the element was visible; it now fails then, so a test that relied on the wrong result can start to fail. 3.1.0: Chrome also starts when the test runs as administrator (e.g. Visual Studio run as admin); before, Chrome relaunched itself without admin rights and the driver failed with "Chrome instance exited". New: BrowserOptions.ConfigureChrome and ConfigureFirefox, and the ChromeArguments / FirefoxArguments settings (VAF_ChromeArguments), add browser options while Testing.On<Chrome>() stays as it is. 3.0.0: .NET 10 alongside .NET Framework 4.7.2, with the same API. No test framework dependency: failed checks throw VafAssertionException, which NUnit 3 and 4, MSTest and xUnit report as a failed test. Only Selenium as a dependency. Settings from VAF_* environment variables or app.config. New: Testing.On(browser) for a browser created with settings (remote grid, extra arguments); LetsSaveScreenshotTo; AndAlso() also after a check; HTML report named per test; a .NET 5-9 project stops at build with error VAF0001. Removed: BrowserStack, the mobile types, WinFormApplication, InternetExplorer and the MSTest v1 screenshot overload. Upgrading from 2.x: see "Migrating from 2.x" in the README.