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

how to stop puppeteer-recorder recording #10

Open
Hretic opened this issue May 29, 2019 · 0 comments
Open

how to stop puppeteer-recorder recording #10

Hretic opened this issue May 29, 2019 · 0 comments

Comments

@Hretic
Copy link

Hretic commented May 29, 2019

im using puppeteer-recorder to record a video from browser activity

here is my code

async function check_login()
{

    try {



        const page = await global_browser.newPage();
        await page.setViewport({width: 1000, height: 1100});

        record({
            browser: global_browser, // Optional: a puppeteer Browser instance,
            page: page, // Optional: a puppeteer Page instance,
            output: path + 'output.webm',
            fps: 60,
            frames: 60 * 5, // 5 seconds at 60 fps
            prepare: function () {}, // <-- add this line
            render: function () {} // <-- add this line

        });

        await page.goto('http://localhost/home_robot/mock.php', {timeout: 60000})
            .catch(function (error) {
                throw new Error('TimeoutBrows');
            });


        await page.close();



    }
    catch (e) {
        console.log(' LOGIN ERROR ---------------------');
        console.log(e);
    }
}

it works fine but i dont know how to stop recording and so when i get to the end of function i get this error

(node:10000) UnhandledPromiseRejectionWarning: Error: Protocol error (Emulation.setDefaultBackgroundColorOverride): Target closed.
    at Promise (C:\wamp64\www\home_robot\node_modules\puppeteer\lib\Connection.js:202:56)
    at new Promise (<anonymous>)
    at CDPSession.send (C:\wamp64\www\home_robot\node_modules\puppeteer\lib\Connection.js:201:12)
    at Page._screenshotTask (C:\wamp64\www\home_robot\node_modules\puppeteer\lib\Page.js:806:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:10000) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (
rejection id: 1)
(node:10000) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and i dont get a video file , i assume its because i close the page without stopping the record

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

No branches or pull requests

1 participant