diff --git a/playwright/async_api.py b/playwright/async_api.py index b9f0ddd1d..ae17c3a51 100644 --- a/playwright/async_api.py +++ b/playwright/async_api.py @@ -5643,6 +5643,7 @@ async def newPage( hasTouch: bool = None, colorScheme: Literal["dark", "light", "no-preference"] = None, acceptDownloads: bool = None, + defaultBrowserType: str = None, ) -> "Page": """Browser.newPage @@ -5708,6 +5709,7 @@ async def newPage( hasTouch=hasTouch, colorScheme=colorScheme, acceptDownloads=acceptDownloads, + defaultBrowserType=defaultBrowserType, ) ) diff --git a/playwright/browser.py b/playwright/browser.py index 97c7d5717..e3b46c874 100644 --- a/playwright/browser.py +++ b/playwright/browser.py @@ -120,8 +120,13 @@ async def newPage( hasTouch: bool = None, colorScheme: ColorScheme = None, acceptDownloads: bool = None, + defaultBrowserType: str = None, ) -> Page: params = locals_to_params(locals()) + # Python is strict in which variables gets passed to methods. We get this + # value from the device descriptors, thats why we have to strip it out. + if "defaultBrowserType" in params: + del params["defaultBrowserType"] context = await self.newContext(**params) page = await context.newPage() page._owned_context = context diff --git a/playwright/sync_api.py b/playwright/sync_api.py index a81399f13..c4f029870 100644 --- a/playwright/sync_api.py +++ b/playwright/sync_api.py @@ -5875,6 +5875,7 @@ def newPage( hasTouch: bool = None, colorScheme: Literal["dark", "light", "no-preference"] = None, acceptDownloads: bool = None, + defaultBrowserType: str = None, ) -> "Page": """Browser.newPage @@ -5941,6 +5942,7 @@ def newPage( hasTouch=hasTouch, colorScheme=colorScheme, acceptDownloads=acceptDownloads, + defaultBrowserType=defaultBrowserType, ) ) ) diff --git a/scripts/expected_api_mismatch.txt b/scripts/expected_api_mismatch.txt index d77871846..fe49248cd 100644 --- a/scripts/expected_api_mismatch.txt +++ b/scripts/expected_api_mismatch.txt @@ -100,3 +100,4 @@ Parameter type mismatch in Selectors.register(script=): documented as Union[Call # Device support Missing parameter documentation: Browser.newContext(defaultBrowserType=) +Missing parameter documentation: Browser.newPage(defaultBrowserType=)