Skip to main content

Playwright Authentication with Escape

Description

The 'Playwright' authentication preset is designed for scenarios where traditional authentication methods are not feasible, and it relies on browser-based automated login:

This preset is particularly useful when you need to authenticate via forms and simply supply inputs

Examples

presets:
- type: playwright
login_url: https://auth.example.com/login
injections:
- key: token
location: browser_local_storage
origin: https://auth.example.com
variable: token
extractions:
- name: token
key: token
location: browser_local_storage
origin: https://auth.example.com
users:
- username: user
email: user@example.com
password: pass

Extensive Configuration

PropertyTypeRequiredDescriptionReference
typeConst[playwright]True
usersPlaywrightUserPresetTrueThe list of users to generate tokens for.PlaywrightUserPreset
login_urlstringTrueThe url that presents the login form
extractionsBrowserExtractionFalseThe token extraction configuration used to extract the tokens
from the HTTP response or the browser storage itself.BrowserExtraction
injectionsTokenInjectionFalseThe injection configuration used to inject the tokens into the HTTP requests.TokenInjection

Objects

PlaywrightUserPreset

PropertyTypeRequiredDescriptionReference
usernamestringTrueThe arbitrary name that identifies the user.
headersDict[string, string]FalseOptional headers injected during the authentication process and in authentified requests.
cookiesDict[string, string]FalseOptional cookies injected during the authentication process and in authentified requests.
emailstringTrueThe email that will be used to auto login
passwordstringTrueThe password that will be used to auto login

BrowserExtraction

PropertyTypeRequiredDescriptionReference
locationBrowserLocationTrueThe location of the browser where the value should be extractedBrowserLocation
originstringTrueThe origin of the local storage or session storage where the value should be extracted
keystringTrueThe key to use for the extracted value, depending on the location
namestringTrueThe name of the variable to store the extracted value into

TokenInjection

PropertyTypeRequiredDescriptionReference
locationHTTPLocationTrueThe location of the HTTP request where the token should be injectedHTTPLocation
keystringTrueThe key to use for the injected token. Its usage depends on the location. For headers, cookies,and query parameters, this key describes the name of the header, cookie or query parameter. For a body location, the key is the field where the token should be injected within the request bodies
prefixstringFalseA prefix to prepend to the token before it is injected
variablestringTrueThe name of a variable to retrieve to create the token's value. If not provided, the token will be infered as the first successful extraction of the procedure

Enums

BrowserLocation

  • browser_local_storage

  • browser_session_storage

HTTPLocation

  • header

  • cookie

  • body

  • query