Hi folks,
I've been using playwright to automate testing of a webauthn application which requires enabling the browser's virtual authenticator support. With Chromium this is really easy to do you just open a CDPSession and send the commands to configure the virtual authenticator:
const devTools = await page.context().newCDPSession(page);
await devTools.send('WebAuthn.enable');
await devTools.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasUserVerification: true,
isUserVerified: true,
hasResidentKey: true,
},
});
This naturally does not work for Webkit browsers. According to the Webkit and Webauthn spec Webkit should be capable of utilizing virtual authenticators. Webkit supports the webdriver extension command for webauthn(https://www.w3.org/TR/webauthn-3/#sctn-automation-add-virtual-authenticator). Talking with devs on the Webkit side they also mentioned that when using WebDriver you need to specify enabling the extension command (https://www.w3.org/TR/webauthn-3/#sctn-automation-webdriver-capability).
Given that playwright is based on a websocket protocol and not webdriver I'm not sure of how I could go about enabling and configuring virtual authenticator support for Webkit in a playwright context. The Chrome DevTools Protocol seems to be pretty much identical to these extension commands so I'm hopeful that there may be a potential solution.
If anyone has thoughts or has managed to test webauthn applications with Playwright, it would be much appreciated.
This thread is trying to answer question "How can I enable and configure virtual Webauthn authenticator support for WebKit in a Playwright context?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].