-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Closed
Labels
chromiumIssues with Puppeteer-ChromiumIssues with Puppeteer-Chromium
Description
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 1.11.0
- Platform / OS version: MacOS Mojave 10.14.1
- URLs (if applicable):
- Node.js version: v10.12.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Create a Chrome extension that uses
chrome.tabCapture.captureinbackground.js:
// background.js
function startRecording() {
chrome.tabCapture.capture(options, stream => {
if (stream === null) {
console.log(`Last Error: ${chrome.runtime.lastError.message}`);
return;
}
try {
const recorder = new MediaRecorder(stream);
} catch (err) {
console.log(err.message);
return;
}
recorder.addEventListener('dataavailable', event => {
console.log(`Got another blob.`);
});
const timeslice = 60 * 1000;
recorder.start(timeslice);
});
}-
In the Puppeteer script, load the extension.
-
In the Puppeteer script, make sure you're listening to console events:
const targets = await browser.targets();
const backgroundPageTarget = targets.find(target => target.type() === 'background_page' && target.url().startsWith('chrome-extension://abcde/'));
const backgroundPage = await backgroundPageTarget.page();
backgroundPage.on('console', msg => {
for (let i = 0; i < msg.args().length; ++i) {
console.log(`${i}: ${msg.args()[i]}`);
}
});- In the Puppeteer script, access the extension's background page, and invoke the function in
background.jsthat callschrome.tabCapture.capture:
...
const test = await backgroundPage.evaluate(() => {
startRecording();
return Promise.resolve(42);
});
...What is the expected result?
I would expect to start seeing a series of Got another blob.s outputted to the console. In other words, a non-null stream parameter.
What happens instead?
Last Error: Requested device not found gets outputted to the console. In other words, the stream parameter of chrome.tabCapture.capture's callback is null.
debianmaster
Metadata
Metadata
Assignees
Labels
chromiumIssues with Puppeteer-ChromiumIssues with Puppeteer-Chromium