Skip to content

[Bug] Videos are not complete when an exception is thrown #432

Closed

Description

I have a script like the following:

try {
    playwright = Playwright.create();
    var launchOptions = new BrowserType.LaunchOptions();
    launchOptions
            .setHeadless(false)
            .setSlowMo(300);
    browser = playwright.chromium().launch(launchOptions);
    var videoPath = Paths.get("videos/");

    var contextOptions = new Browser.NewContextOptions()
            .setViewportSize(1920, 1080)
            .setRecordVideoDir(videoPath)
            .setRecordVideoSize(1920,1080);

    context = browser.newContext(contextOptions);
    page = context.newPage();
    page.setDefaultTimeout(60000);

    // do stuff in the web that eventually causes an exception (`Frame.waitForSelector failed` for example)
} catch (Exception e) {
    e.printStackTrace();
} finally {
    page.close();
    context.close();
    browser.close();
    playwright.close();
}

The video is recorded and saved just fine but when i compare where the script failed and the recorded video, the video is missing the end of the script before it failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions