I'm getting a "Select a certificate to authenticate" pop up window when I launch application, I tried keyboard event like pressing Enter Key to select pop up, but it's not working. is there any way to select OK button ?
const playwright = require('playwright');
browser = await playwright['chromium'].launch({ headless: false, args: ['--start-maximized', '--ignore-certificate-errors'] })
const context = await browser.newContext({ viewport: null });
const page = await context.newPage();
await page.goto(domain);
await page.waitForTimeout(6000)
await page.keyboard.press('Enter');

In Playwright version 1.46, support for TLS Client Certificates was added.
Here's an example using PEM format:
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
clientCertificates: [{
origin: 'https://example.com',
certPath: './cert.pem',
keyPath: './key.pem',
passphrase: 'mysecretpassword',
}],
},
});
And here's an example using PFX format:
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
clientCertificates: [{
origin: 'https://example.com',
pfxPath: './cert.pfx',
passphrase: 'mysecretpassword',
}],
},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With