You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: playwright/async_api.py
+51-33Lines changed: 51 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -1295,7 +1295,7 @@ async def screenshot(
1295
1295
self,
1296
1296
timeout: int=None,
1297
1297
type: Literal["png", "jpeg"] =None,
1298
-
path: str=None,
1298
+
path: typing.Union[str, pathlib.Path]=None,
1299
1299
quality: int=None,
1300
1300
omitBackground: bool=None,
1301
1301
) ->bytes:
@@ -1309,7 +1309,7 @@ async def screenshot(
1309
1309
Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.
1310
1310
type : Optional[Literal['png', 'jpeg']]
1311
1311
Specify screenshot type, defaults to `png`.
1312
-
path : Optional[str]
1312
+
path : Union[str, pathlib.Path, NoneType]
1313
1313
The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk.
1314
1314
quality : Optional[int]
1315
1315
The quality of the image, between 0-100. Not applicable to `png` images.
Adds a script which would be evaluated in one of the following scenarios:
@@ -3966,7 +3982,7 @@ async def screenshot(
3966
3982
self,
3967
3983
timeout: int=None,
3968
3984
type: Literal["png", "jpeg"] =None,
3969
-
path: str=None,
3985
+
path: typing.Union[str, pathlib.Path]=None,
3970
3986
quality: int=None,
3971
3987
omitBackground: bool=None,
3972
3988
fullPage: bool=None,
@@ -3982,7 +3998,7 @@ async def screenshot(
3982
3998
Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.
3983
3999
type : Optional[Literal['png', 'jpeg']]
3984
4000
Specify screenshot type, defaults to `png`.
3985
-
path : Optional[str]
4001
+
path : Union[str, pathlib.Path, NoneType]
3986
4002
The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk.
3987
4003
quality : Optional[int]
3988
4004
The quality of the image, between 0-100. Not applicable to `png` images.
@@ -4618,7 +4634,7 @@ async def pdf(
4618
4634
height: typing.Union[str, float] =None,
4619
4635
preferCSSPageSize: bool=None,
4620
4636
margin: PdfMargins=None,
4621
-
path: str=None,
4637
+
path: typing.Union[str, pathlib.Path]=None,
4622
4638
) ->bytes:
4623
4639
"""Page.pdf
4624
4640
@@ -4692,7 +4708,7 @@ async def pdf(
4692
4708
Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format` options. Defaults to `false`, which will scale the content to fit the paper size.
The file path to save the PDF to. If `path` is a relative path, then it is resolved relative to current working directory. If no path is provided, the PDF won't be saved to the disk.
Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk.
5599
5617
args : Optional[List[str]]
5600
5618
Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
@@ -5616,7 +5634,7 @@ async def launch(
5616
5634
**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
5675
5693
args : Optional[List[str]]
5676
5694
Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
@@ -5692,7 +5710,7 @@ async def launchServer(
5692
5710
**Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
5771
5789
args : Optional[List[str]]
5772
5790
Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
0 commit comments