NUnit (C#)
Use this guide for Selenium C# tests executed with NUnit. Accessibility is enabled on the RemoteWebDriver session using the same capability keys as Java (reference); NUnit only controls how and when tests run.
Browsers: Use Chrome or Edge with supported versions.
Prerequisites
LT_USERNAME/LT_ACCESS_KEY(or your chosen secret injection in CI)- Selenium 4
RemoteWebDriverpointing at the TestMu AI hub - NUnit 3+ test project
Onboarding path
1. Set capabilities in your driver factory
Typical pattern in [SetUp] or a one-time fixture:
var options = new ChromeOptions();
options.BrowserVersion = "latest";
options.AddAdditionalOption("accessibility", true);
options.AddAdditionalOption("accessibility.wcagVersion", "wcag21aa"); // optional
// options.AddAdditionalOption("accessibility.autoscan", true); // optional
var driver = new RemoteWebDriver(new Uri("https://hub.lambdatest.com/wd/hub"), options.ToCapabilities());
Exact hub URL and capability names should match your existing grid configuration; only the accessibility* keys are specific to this feature.
2. Invoke the scan hook (if not using auto-scan)
After navigation and waits:
((IJavaScriptExecutor)driver).ExecuteScript("lambda-accessibility-scan");
Without either the hook or accessibility.autoscan, you will not get Accessibility reports.
3. Run NUnit
dotnet test
or Visual Studio Test Explorer.
4. Open the Accessibility report
Automation Dashboard → build → Accessibility tab (same as Selenium guide).
Troubleshooting
| Symptom | What to check |
|---|---|
| Capability ignored | Selenium 4 requires AddAdditionalOption on ChromeOptions (or equivalent) for vendor-specific keys—verify spelling. |
| No report | Confirm hook or autoscan as above. |
