puppeteer-extra icon indicating copy to clipboard operation
puppeteer-extra copied to clipboard

[Bug] stuck browser.close() puppeteer-extra-plugin-stealth"^2.9.0"

Open rstorm861 opened this issue 2 years ago • 3 comments

  1. Run electron
  2. Press the button multiple times
  3. multiple browser starts up
  4. broeser.close()
  5. Stuck

If don't use stealth, it works fine https://github.com/rstorm861/puppeteer_test

index.html

<!DOCTYPE html>
<html>
  <head>
    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/icon?family=Material+Icons"
    />
    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
    />
    <meta charset="utf-8" />
    <title>test</title>
  </head>
  <body>
    <button onclick="onTest();">test</button>
  </body>

  <script>
    const ipcRenderer = window.api;
    function onTest() {
      ipcRenderer.send("test");
    }
  </script>
</html>

main.js

const { app, dialog, BrowserWindow } = require("electron");
const path = require("path");
const ipcMain = require("electron").ipcMain;

ipcMain.on("test", function (event, ...arg) {
  test();
});

const puppeteer = require("puppeteer-extra");
const StealthPlugin = require("puppeteer-extra-plugin-stealth");
puppeteer.use(StealthPlugin());

async function test() {
  puppeteer.launch({ headless: false, executablePath: chromepath }).then(async (browser) => {
    const page = await browser.newPage();
    await page.setViewport({ width: 800, height: 600 });
    await page.goto("https://bot.sannysoft.com");
    await browser.close();
  });
}

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "electron ."
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron": "^17.0.0"
  },
  "dependencies": {
    "chrome-paths": "^1.0.1",
    "puppeteer-extra": "^3.2.3",
    "puppeteer-extra-plugin-stealth": "^2.9.0"
  }
}

rstorm861 avatar Feb 14 '22 16:02 rstorm861

I'm having the same issue.

C2BB avatar Apr 12 '22 10:04 C2BB

@berstend mentioned on discord to use addExtra if you want to run multiple instances

kbourro avatar Jun 28 '22 11:06 kbourro

Might be connected to #656

berstend avatar Jul 07 '22 19:07 berstend