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

feature: ability to keep the browser window open (for testing & debugging) #283

Open
zsolt-dev opened this issue Dec 18, 2023 · 1 comment
Labels

Comments

@zsolt-dev
Copy link

Problem:

I use the programatic API to generate a PDF from a markdown variable. When I generate PDFs, it would help me to analyse the HTML and debug issues / play around in the browser devtools console.

But setting this just opens to browser for a split second.

launch_options: {
        headless: false,
        devtools: true,
}

Solution:

ability to provide a setting that would keep the browser open.

@simonhaenisch
Copy link
Owner

Sry for the late response due to sickness.

There's a --devtools CLI flag that does exactly this (without the headless: false which iirc is implied when devtools is enabled), and last time i tried it worked, but it's been a long while.

Just looking into it and I think the problem is that here it's checking only the config option but not the launch_options:

if (config.devtools) {
await new Promise((resolve) => page.on('close', resolve));

Should change this to access the property from the Puppeteer browser class I guess, but in the meantime you should be able to get it to work by setting devtools: true in the config that you pass to the mdToPdf function call.

@simonhaenisch simonhaenisch added bug and removed feature labels Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants