Playwright - Bypassing Fido2 u2f

428 Views Asked by At

I'm using Playwright to automate things on a website that I am using Fido2 u2f. I can't run it in headless mode as I need to be ready to touch my u2f when it's prompted. This is very annoying.

Is there a way to accept the u2f without me having to click it? Via code.

Thank you.

1

There are 1 best solutions below

0
On

You can use the virtual authenticators API defined in the WebAuthn spec to programmatically set up automatic responses to WebAuthn in your automated testing pipeline .

The endpoints defined in there are REST requests you make in the browser, so as long as PlayWright gives you a mechanism for executing JS in the headless browser you're testing with then you should be able to set up a software authenticator to respond to WebAuthn API invocations without any interaction on your part.