-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Description
Hello, I am running the following script on a linux OS:
const { launch, getStream } = require("puppeteer-stream");
const fs = require("fs");
const file = fs.createWriteStream(__dirname + "/test.webm");
async function test() {
const browser = await launch({
args: ['--no-sandbox'],
allowIncognito: true,
executablePath:'/web/download/node_modules/puppeteer/.local-chromium/linux-1056772/chrome-linux/chrome',
headless: false,
defaultViewport: {
width: 1280,
height: 1024
},
ignoreDefaultArgs: ["--disable-extensions", "--mute-audio"]
});
const page = await browser.newPage();
await page.goto("https://www.bilibili.com/video/BV1kL411h7D5/");
console.log("beginning......");
const stream = await getStream(page, { audio: true, video: true });
console.log("recording......");
stream.pipe(file);
}
test();
But it always throws the following exception: timeout 30000ms exceeded
In order to be able to locate the problem, I added a log to the waitForTarget
method in node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js
CODE:
async waitForTarget(predicate, options = {}) {
...
try {
this.targets().forEach(check);
if (!timeout) {
return await targetPromise;
}
return await (0, util_js_1.waitWithTimeout)(targetPromise, 'target', timeout);
}
...
async function check(target) {
console.log("<======check======>" + target.type() + ":" + target.url());
if ((await predicate(target)) && !targetPromise.resolved()) {
targetPromise.resolve(target);
}
}
The exception information is as follows:
<======check======>browser:
<======check======>page:about:blank
beginning......
<======check======>browser:
<======check======>page:about:blank
<======check======>service_worker:chrome-extension://jjndjgheafjngoipoacpjgeicjeomjli/background.js
<======check======>page:about:blank
<======check======>service_worker:chrome-extension://jjndjgheafjngoipoacpjgeicjeomjli/background.js
<======check======>service_worker:chrome-extension://jjndjgheafjngoipoacpjgeicjeomjli/background.js
/web/download/node_modules/puppeteer-core/lib/cjs/puppeteer/common/util.js:292
const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${taskName} failed: timeout ${timeout}ms exceeded`);
^
TimeoutError: waiting for target failed: timeout 30000ms exceeded
at waitWithTimeout (/web/download/node_modules/puppeteer-core/lib/cjs/puppeteer/common/util.js:292:26)
at CDPBrowser.waitForTarget (/web/download/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js:342:56)
at /web/download/node_modules/puppeteer-stream/dist/PuppeteerStream.js:107:47
at Generator.next (<anonymous>)
at /web/download/node_modules/puppeteer-stream/dist/PuppeteerStream.js:31:71
at new Promise (<anonymous>)
at __awaiter (/web/download/node_modules/puppeteer-stream/dist/PuppeteerStream.js:27:12)
at getExtensionPage (/web/download/node_modules/puppeteer-stream/dist/PuppeteerStream.js:106:12)
at /web/download/node_modules/puppeteer-stream/dist/PuppeteerStream.js:132:33
at Generator.next (<anonymous>)
Version:
node:v16.14.0
npm:8.3.1
os:Linux version 3.10.0-1160.66.1.el7.x86_64
puppeteer:19.2.2
puppeteer-stream:3.0.3
chrome:linux-1056772
Hope to get your help,Thanks!
Metadata
Metadata
Assignees
Labels
No labels