Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions playwright/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -5708,6 +5709,7 @@ async def newPage(
hasTouch=hasTouch,
colorScheme=colorScheme,
acceptDownloads=acceptDownloads,
defaultBrowserType=defaultBrowserType,
)
)

Expand Down
5 changes: 5 additions & 0 deletions playwright/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions playwright/sync_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -5941,6 +5942,7 @@ def newPage(
hasTouch=hasTouch,
colorScheme=colorScheme,
acceptDownloads=acceptDownloads,
defaultBrowserType=defaultBrowserType,
)
)
)
Expand Down
1 change: 1 addition & 0 deletions scripts/expected_api_mismatch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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=)