getProfiles()
Get a list of all available browser profile labels.Signature
Returns
Array of profile names that can be used with thebrowser option.
Example
Using a random profile
getOperatingSystems()
Get a list of all available operating systems for emulation.Signature
Returns
Array of OS names that can be used with theos option.
Example
Combining browser and OS
resolveProfile()
Resolve a browser family alias to the concrete profile it points at.Signature
Returns
The concrete profile. Concrete profiles pass through unchanged, so this is safe to call on any value accepted by thebrowser option.
Example
getEmulationHeaders()
Get the headers a browser profile injects into every request, without sending one.Signature
fetch.
Returns
AHeaders instance holding the profile’s headers, in the profile’s own order and casing.
Transport-level headers are not included: Host, Connection, Content-Length, and
Accept-Encoding are added per request rather than by the emulation profile.
Example
Reusing a profile’s User-Agent
Passing a header throughheaders replaces the profile’s matching header and leaves the
rest of the fingerprint intact, so read the value first when you want to build on it.
Headers
TheHeaders class for working with HTTP headers.
Constructor
Methods
append(name, value): add a header valuedelete(name): remove a headerget(name): get a header valuehas(name): check if header existsset(name, value): set a header valueentries(): iterate over header entrieskeys(): iterate over header namesvalues(): iterate over header values
Example
Response
TheResponse class representing HTTP responses.
Properties
status: HTTP status codestatusText: HTTP status textheaders: response headersok:trueif status is 200-299url: final URL after redirectsredirected:trueif the response is the result of a redirectbody:ReadableStream<Uint8Array>ornullbodyUsed:trueif body has been readcontentLength: content length from headers, ornullcookies: parsed response cookies asRecord<string, string | string[]>
Methods
json(): parse body as JSONtext(): get body as stringarrayBuffer(): get body as ArrayBufferbytes(): get body as Uint8Arrayblob(): get body as BlobformData(): parse body as FormDataclone(): clone the response