🔐 Virtual Authenticator & Advanced Features

Virtual Authenticator & Advanced: Virtual Authenticator is a software-based hardware simulator that Selenium injects into the browser for testing WebAuthn (FIDO2/Passkey) flows —

Virtual Authenticator is a software-based hardware simulator that Selenium injects into the browser for testing WebAuthn (FIDO2/Passkey) flows — exactly like using an H2 in-memory database instead of a real database in Java tests: the interface is identical, only the underlying implementation is swapped for the test context. If you can already mock the service layer with Mockito, why do you need a hardware simulator at the browser level? Because Passkey authentication happens inside the browser's own WebAuthn API, not in your application code — you cannot Mockito-mock a browser API; instead, you must tell the browser "a virtual authenticator is present." In Java you call addVirtualAuthenticator(options) to inject the virtual device, which replaces the physical USB security key and drives the full FIDO2 flow end-to-end. The critical QA scenario: when your company decides to drop passwords in favor of Passkeys, regression tests for the login flow can now run automatically in a CI pipeline without a physical dongle — without Virtual Authenticator, this test category can only be executed manually, leaving a permanent gap in your automation coverage.

Selenium 4 introduces the Virtual Authenticator API to support WebAuthn (Passkeys, FIDO2) testing. It also features a new Print API for saving pages as PDFs, and Pen & Wheel Actions for advanced stylus and scroll-wheel gestures.

1. Virtual Authenticator (WebAuthn / Passkeys)

Java — Setting up a Virtual Authenticator

Micro Lab: Selenium — UI Actions

Replace the TODO line with the critical line from the expected solution. This is not a real runtime; the goal is to reinforce writing the correct structure in a controlled way.

Step by Step: Selenium — UI Actions

Find element with locator (By.ID, By.CSS or By.XPath)

Verify element is clickable with WebDriverWait

Perform the click() / sendKeys() / select() action

Observe the DOM change after action (alert, new page, color, etc.)

Prove the expected state with assertEquals / assertTrue

🎬 Do You Need a USB Key to Test Passkeys? No.

"We're switching to Passkeys" decision