79397076

Date: 2025-01-29 14:37:17
Score: 5
Natty:
Report link

I am facing same issue with Playwright Version 1.50.0 and latest Chromium version. Here is my code

    import { test } from '@playwright/test';
    import { defineConfig } from '@playwright/test';
    const path = require('path');
    const fs = require('fs');

    export default defineConfig({
    use: {
        clientCertificates: [{
          origin: 'https://t01:8443/Ter/#/login',
          pfxPath: 'C:/o/tk/cert/t-lp-tre/t-lp-truststore.p12',
          passphrase: 'tore', 
        }],       
      },      
    });

    // Main login function
    async function login(browser, username, password) {
      console.log('Starting login process...');

        const context = await browser.newContext({
        ignoreHTTPSErrors: true, 
      });

      const page = await context.newPage();     
      
      await page.goto("https://t01:8443/Ter/#/login");

      console.log('Navigating to the login page...');     

      console.log('Filling in credentials...');
      await page.fill('input[placeholder="Username"]', username);
      await page.fill('input[placeholder="Password"]', password);
      await page.click('button[type="submit"]');  
      await page.waitForLoadState('load'); 

      console.log(`${username} logged in successfully`);
    }

    test('Run Tests with Parallel Users', async ({ browser }) => {
      const dataPath = 'testdata/testdata_2Usr.json';
      const testData = await fs.promises.readFile(dataPath, 'utf-8');
      const jsonData = JSON.parse(testData);
      
      for (const user of jsonData) {
        const { username, password } = user;
        await login(browser, username, password);
      }
    });

And after using solution provided by Max, I am still not able to handle TLS Client Certificates pop up. I even tried with third party utilities like autoIT but still not able to click on 'ok' on 'select certificate' pop up. Can someone please help? (Sorry fairly new to Playwright and js)

Reasons:
  • RegEx Blacklisted phrase (3): please help
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I am facing same issue
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Finch