Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] browserContext.close takes too long when recording videos #4148

Closed
Snikanes opened this issue Oct 15, 2020 · 0 comments · Fixed by #4164
Closed

[BUG] browserContext.close takes too long when recording videos #4148

Snikanes opened this issue Oct 15, 2020 · 0 comments · Fixed by #4164

Comments

@Snikanes
Copy link

Snikanes commented Oct 15, 2020

Context:

  • Playwright Version: 1.5.0 and 1.5.1
  • Operating System: Linux
  • Node.js version: 12.18.3
  • Browser: Reproduced in Chromium, unsure about other browsers
  • Extra: Nothing in particular

Code Snippet

import { chromium } from "playwright";

(async () => {
  const videosPath = "./videocapture"; // Make sure this directory exists
  const browser = await chromium.launch({
    headless: true, // Headless or headful makes no difference
  });
  const context = await browser.newContext({
    videosPath, // Omitting videosPath makes browserContext.close take a few milliseconds
  });
  const page = await context.newPage();

  await page.goto("https://www.google.com"); // browserContext.close takes around 1 sec if only this page is loaded
  await page.goto("https://www.vg.no"); // browserContext.close takes around 4 secs if this and preceding pages are loaded
  await page.goto("https://www.dagbladet.no"); // browserContext.close takes around 5 secs if this and preceding pages are loaded
  await page.goto("https://www.aftenposten.no"); // browserContext.close takes around 9 secs if this and preceding pages are loaded
  await page.goto("https://www.dagsavisen.no"); // browserContext.close takes around 18-31 secs if this and preceding pages are loaded

  await page.close();
  await context.close();
  await browser.close();
})();

Screenshot from 2020-10-15 09-51-02

Describe the bug
When recording videos with the new stable video recording API, I find that closing browserContexts scales badly with video length. The snippet above provides a minimal reproducible example. I haven't tested very thoroughly, but enough that I am confident that there are some performance concerns here that should be addressed.

I would expect that saving a video should add much less overhead to browserContext.close than shown above, which https://github.com/qawolf/playwright-video manages to do pretty well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants