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

Add --browser option to export #1196

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yheuhtozr
Copy link
Contributor

Closes #1195.

Not tested yet because I was not able to correctly build this package locally.


const { chromium } = await import('playwright-chromium')
const browser = await chromium.launch()
const { playwright } = await import(browserPackage)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this works fine?

I think the following seems better. Make bundler more friendly knows which is imported here, instead of a dynamic string, even if you have checked before.

function loadBrowser(browserPackage) {
  if (browserPackage == 'chromium') {
    return import('playwright-chromium')
  } else ...
}

@carlobellettini
Copy link

carlobellettini commented Mar 5, 2024

I think that playwright support PDF generation only with the Chromium version

[0] microsoft/playwright#2206
[1] https://playwright.dev/docs/api/class-page#page-pdf

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

Successfully merging this pull request may close these issues.

Export using Firefox (or any browser engine Playwright supports)
3 participants