playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[BUG] Webkit browser stuck at `await context.close();` sometimes when `recordHar` is enabled

Open niranjan94 opened this issue 3 years ago • 0 comments

Context:

  • Playwright Version: 1.28.1
  • Operating System: Linux 5.10 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
  • Node.js version: 18.12.1
  • Browser: WebKit

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally. For example:

import {webkit, chromium} from 'playwright';

const sites = [
  'https://news.google.com',
  'https://www.nytimes.com',
  'https://www.cnn.com',
  'https://www.theverge.com',
  'https://www.engadget.com',
  'https://www.techcrunch.com',
]

(async () => {
  const browser = await webkit.launch({
    headless: false,
  });
  const context = await browser.newContext({
    recordHar: {
      path: 'test.har',
      omitContent: false,
    }
  });

  console.log('started.')
  const page = await context.newPage();
  for (const site of sites) {
    console.log(`visiting ${site}`)
    try {
      await page.goto(site);
    } catch (e) {
      console.error(`error visiting ${site}: ${e}`)
    }
  }
  console.log('completed.')

  console.log('closing context')
  await context.close();

  console.log('closing browser')
  await browser.close();
})();

Describe the bug

When using webkit with HAR Recording enabled, the context cannot be closed correctly and will stay stuck indefinitely. This behaviour is not consistently reproducible .

niranjan94 avatar Dec 15 '22 17:12 niranjan94