Skip to content

Support Playwright credentials #4979

Description

@aaltat

Is your feature request related to a problem? Please describe.
Add support for https://playwright.dev/docs/api/class-credentials feature.

Describe the solution you'd like
Credentials are tied to the context. I think there should be three keywords.

  1. Create Credential would call https://playwright.dev/docs/api/class-credentials#credentials-create and https://playwright.dev/docs/api/class-credentials#credentials-install To set the credential in the context. Also calling with None values would only call https://playwright.dev/docs/api/class-credentials#credentials-install
  2. Get Credential would be direct wrapper for https://playwright.dev/docs/api/class-credentials#credentials-get
  3. Delete Credential would be direct wrapper for https://playwright.dev/docs/api/class-credentials#credentials-delete

Keyword usage would look like this:

New Context
Create Credential    # This calls both create and install credentials automatically
...    rpId=example.com
...    id=${knownCredentialId}   #base64url
...    userHandle=${known_user_handle}    #Base64url-encoded PKCS#8 (DER) private key. 
...    publicKey=${public_key}    #Base64url-encoded SPKI (DER) public key.
...    userHandle=${user_handle}    #Base64url-encoded user handle. 
New Page    https://example.com

New Context
Create Credential    # This calls only install credential
New Page    https://example.com
# Do something that created a credential
${credential} =    Get Credential    id=${credential_id}
${credential} =    Get Credential    rpId=${credential_rpId}
# ${credential}  is dictionary (RF dotdict) which has id, rpId, userHandle privateKey and publicKey  as keys.
Delete Credential    id=${credential_id}

I do not like word id in dictionary or in arguments, because id reserved work in Python. So adding underscore (id_) or calling id credential_id are better options.

Additional context
https://playwright.dev/docs/api/class-credentials

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions