Tap WebAuthn Passkey Confirmation
# i-need-help
r
Hello, I'm using a virtual authenticator for WebAuthn based pass keys in my CI. Here's a code example:
Copy code
before(() => {
    Cypress.automation("remote:debugger:protocol", {
      command: "WebAuthn.enable",
      params: {
        enableUI: true,
      },
    }).then(() => {
      return Cypress.automation("remote:debugger:protocol", {
        command: "WebAuthn.addVirtualAuthenticator",
        params: {
          options: {
            protocol: "ctap2",
            transport: "internal",
            hasResidentKey: true,
            hasUserVerification: false,
            isUserVerified: true,
          },
        },
      }).then((result) => {
        _AUTHENTICATOR_ID = result.authenticatorId;
      });
    });

    cy.clearCookies();
    cy.visit(
      "/assets/polygon/0xE95C167E3147F2F935E6B90F16694BC9ED4399E4"
    );
  });
I'm able to successfully get a passkey modal to appear, but I do not know how to tap the button in the modal using Cypress. I've attached a screenshot. I appreciate any insight you may be able to provide. Thank you! -Brandon

https://cdn.discordapp.com/attachments/1110655231638917272/1110655231785713714/WebAuthn_Prompt.png

e
Looks like its in a new iframe. This should help https://www.lambdatest.com/blog/how-to-handle-iframes-in-cypress/
r
@echoing-tent-95037 I’ll give this a try thank you! One question, how did you know this was an iframe? It appears to be more of a built in Chrome modal whereas my typical understanding of iframes is that they are specified using HTML within a webpage. Appreciate your help here.
e
From my understanding popups like that are in separate iframes.
r
@echoing-tent-95037 This guide references identifying the iFrame inside the DOM, but the problem (as can be seen in the image) is that this modal isn't actually part of the DOM, e.g. even if you open the web inspector it is not a part of the page hierarchy
as far as I can tell there's no way to get an ID or class name for the modal
e
Oh gotcha, I see now. That's the passkey feature for chrome doing the popup. I'm honestly not sure how to handle that.
4 Views