diff --git a/mkdocs_exporter/formats/pdf/browser.py b/mkdocs_exporter/formats/pdf/browser.py index 7ab7c57..ba6fad9 100644 --- a/mkdocs_exporter/formats/pdf/browser.py +++ b/mkdocs_exporter/formats/pdf/browser.py @@ -37,6 +37,7 @@ def __init__(self, options: dict = {}): self.playwright = None self.lock = asyncio.Lock() self.debug = options.get('debug', False) + self.channel = options.get('channel', '') self.headless = options.get('headless', True) self.timeout = options.get('timeout', 60_000) self.args = self.args + options.get('args', []) @@ -61,7 +62,7 @@ async def launch(self) -> Browser: logger.info('[mkdocs-exporter.pdf] Launching browser...') self.playwright = await async_playwright().start() - self.browser = await self.playwright.chromium.launch(headless=self.headless, args=self.args) + self.browser = await self.playwright.chromium.launch(headless=self.headless, args=self.args, channel=self.channel) self.context = await self.browser.new_context() self.context.on('console', self.log) diff --git a/mkdocs_exporter/formats/pdf/config.py b/mkdocs_exporter/formats/pdf/config.py index c2431d0..abcd0e5 100644 --- a/mkdocs_exporter/formats/pdf/config.py +++ b/mkdocs_exporter/formats/pdf/config.py @@ -8,6 +8,9 @@ class BrowserConfig(BaseConfig): debug = c.Type(bool, default=False) """Should console messages sent to the browser be logged?""" + channel = c.Choice(['', 'chrome', 'msedge', 'chrome-beta', 'msedge-beta', 'msedge-dev'], default='') + """The browser channel to use. (https://playwright.dev/python/docs/browsers#google-chrome--microsoft-edge)""" + headless = c.Type(bool, default=True) """Should the browser start in headless mode?"""