← Back to Discord Forum

Error in launch 10 browsers

drilldillerposted in #help-playwright
Open in Discord

Hi everyone! I am running 10 playwright browsers at the same time and out of them only one of them is working properly. I definitely need to run the browsers in non incognito mode. Here is my code:

const browser = await chromium.launchPersistentContext(
      timeout: 30000,
      headless: true,
      bypassCSP: true,
      ignoreHTTPSErrors: true,
      timezoneId: 'America/Los_Angeles',
         'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.187 Safari/537.36',
      args: [

      ignoreDefaultArgs: ['--enable-automation'],
      javaScriptEnabled: true,

This is error:

This thread is trying to answer question "Why are only one out of 10 playwright browsers working properly when launched simultaneously?"

10 replies

How other not working properly?

@skorp32: I run 10 browsers at the same time and only 1 of them works and the others throw the errors I mentioned above.

I run 10 browsers at the same time and only 1 of them works and the others throw the errors I mentioned above.

Any chance your machine does not have enough resources for 10 browsers?

No, I have a server with 128 RAM and 16 cores.

the server is not loaded during operation

every time I start the browser, I generate a userDataFolder this way

const userDataFolder = `./foo-${uuid()}`;
@drilldiller: @skorp32 can it throw an error?

@skorp32 can it throw an error?

What way are you using to start them at the same time? I don't know if Playwright library is thread safe. At least for Python and Java it is not.

And how sure are you that you really need non-incognito mode? Launching 10 browsers instead of just 10 lightweight browser contexts inside the same browser is using a lot more resources.

If all you need is cookies and local storage to be saved/restored, then you could alternatively use the storage state feature. https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state

On the NodeJS side you could probably rely on async instead of threading to do things in parallel. Most of the time the NodeJS code will be waiting for the real work to be done by the browsers.

Ah, and I think I know the cause of your error (just in case you want to continue that path): --remote-debugging-port=9222

Each browser instance should use a unique port for the remote debugging.

@refactoreric: Yes, that helped, thank you so much!

Yes, that helped, thank you so much!

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.