feedback 4
This commit is contained in:
parent
3ba7fed980
commit
481a9f65a8
|
|
@ -343,6 +343,9 @@ use a temporary directory instead.
|
|||
### option: BrowserType.launchPersistentContext.firefoxUserPrefs2 = %%-csharp-java-browser-option-firefoxuserprefs-%%
|
||||
* since: v1.40
|
||||
|
||||
### option: BrowserType.launchPersistentContext.clientCertificates = %%-context-option-clientCertificates-%%
|
||||
* since: 1.46
|
||||
|
||||
## async method: BrowserType.launchServer
|
||||
* since: v1.8
|
||||
* langs: js
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ export abstract class Browser extends SdkObject {
|
|||
if (options.clientCertificates?.length) {
|
||||
clientCertificatesProxy = new ClientCertificatesProxy(options);
|
||||
options.proxy = { server: await clientCertificatesProxy.listen() };
|
||||
options.ignoreHTTPSErrors = true;
|
||||
}
|
||||
const context = await this.doCreateNewContext(options);
|
||||
context._clientCertificatesProxy = clientCertificatesProxy;
|
||||
|
|
|
|||
|
|
@ -693,8 +693,6 @@ export function validateBrowserContextOptions(options: channels.BrowserNewContex
|
|||
throw new Error('Cannot specify both proxy and clientCertificates');
|
||||
options.proxy = normalizeProxySettings(options.proxy);
|
||||
}
|
||||
if (options.clientCertificates?.length)
|
||||
options.ignoreHTTPSErrors = true;
|
||||
verifyGeolocation(options.geolocation);
|
||||
verifyClientCertificates(options.clientCertificates);
|
||||
}
|
||||
|
|
|
|||
41
packages/playwright-core/types/types.d.ts
vendored
41
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -13221,6 +13221,47 @@ export interface BrowserType<Unused = {}> {
|
|||
*/
|
||||
chromiumSandbox?: boolean;
|
||||
|
||||
/**
|
||||
* An array of client certificates to be used. Each certificate object must have `cert` and `key` or `pfx` to load the
|
||||
* client certificate. Optionally, `passphrase` property should be provided if the private key is encrypted. If the
|
||||
* certificate is issued by a custom certificate authority, the `ignoreHTTPSErrors` needs to be set. If the
|
||||
* certificate is valid only for specific URLs, the `url` property should be provided with a glob pattern to match the
|
||||
* URLs that the certificate is valid for.
|
||||
*
|
||||
* **NOTE** Using Client Certificates in combination with Proxy Servers is not supported.
|
||||
*/
|
||||
clientCertificates?: Array<{
|
||||
/**
|
||||
* Glob pattern to match the URLs that the certificate is valid for.
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* List of client certificates to be used.
|
||||
*/
|
||||
certs: Array<{
|
||||
/**
|
||||
* Path to the file with the certificate in PEM format.
|
||||
*/
|
||||
cert?: string;
|
||||
|
||||
/**
|
||||
* Path to the file with the private key in PEM format.
|
||||
*/
|
||||
key?: string;
|
||||
|
||||
/**
|
||||
* Passphrase for the private key (PEM or PFX).
|
||||
*/
|
||||
passphrase?: string;
|
||||
|
||||
/**
|
||||
* Path to the PFX or PKCS12 encoded private key and certificate chain.
|
||||
*/
|
||||
pfx?: string;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
|
||||
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ test.describe('browser', () => {
|
|||
await page.close();
|
||||
});
|
||||
|
||||
test('should fail with untrusted client certs', async ({ browser, serverURLRewrittenToLocalhost, asset }) => {
|
||||
test('should throw with a untrusted CA', async ({ browser, serverURLRewrittenToLocalhost, asset }) => {
|
||||
const page = await browser.newPage({
|
||||
clientCertificates: [{
|
||||
url: serverURLRewrittenToLocalhost,
|
||||
|
|
|
|||
Loading…
Reference in a new issue