|
| None | start (self, *typing.Optional[str] name=None, typing.Optional[str] title=None, typing.Optional[bool] snapshots=None, typing.Optional[bool] screenshots=None, typing.Optional[bool] sources=None) |
| |
| None | start_chunk (self, *typing.Optional[str] title=None, typing.Optional[str] name=None) |
| |
| None | stop_chunk (self, *typing.Optional[typing.Union[pathlib.Path, str]] path=None) |
| |
| None | stop (self, *typing.Optional[typing.Union[pathlib.Path, str]] path=None) |
| |
| None | group (self, str name, *typing.Optional[TracingGroupLocation] location=None) |
| |
| None | group_end (self) |
| |
| None | __init__ (self, Any impl_obj) |
| |
|
str | __str__ (self) |
| |
| None | on (self, Any event, Any f) |
| |
| None | once (self, Any event, Any f) |
| |
| None | remove_listener (self, Any event, Any f) |
| |
|
str | __repr__ (self) |
| |
|
|
Any | _sync (self, Union[Coroutine[Any, Any, Any], Generator[Any, Any, Any]] coro) |
| |
|
Callable[..., None] | _wrap_handler (self, Union[Callable[..., Any], Any] handler) |
| |
|
| _dispatcher_fiber |
| |
|
| _loop |
| |
|
| _impl_obj |
| |
◆ group()
| None playwright.sync_api._generated.Tracing.group |
( |
|
self, |
|
|
str |
name, |
|
|
*typing.Optional[TracingGroupLocation] |
location = None |
|
) |
| |
Tracing.group
**NOTE** Use `test.step` instead when available.
Creates a new group within the trace, assigning any subsequent API calls to this group, until
`tracing.group_end()` is called. Groups can be nested and will be visible in the trace viewer.
**Usage**
```py
# All actions between group and group_end
# will be shown in the trace viewer as a group.
await page.context.tracing.group(\"Open Playwright.dev > API\")
await page.goto(\"https://playwright.dev/\")
await page.get_by_role(\"link\", name=\"API\").click()
await page.context.tracing.group_end()
```
Parameters
----------
name : str
Group name shown in the trace viewer.
location : Union[{file: str, line: Union[int, None], column: Union[int, None]}, None]
Specifies a custom location for the group to be shown in the trace viewer. Defaults to the location of the
`tracing.group()` call.
◆ group_end()
| None playwright.sync_api._generated.Tracing.group_end |
( |
|
self | ) |
|
Tracing.group_end
Closes the last group created by `tracing.group()`.
◆ start()
| None playwright.sync_api._generated.Tracing.start |
( |
|
self, |
|
|
*typing.Optional[str] |
name = None, |
|
|
typing.Optional[str] |
title = None, |
|
|
typing.Optional[bool] |
snapshots = None, |
|
|
typing.Optional[bool] |
screenshots = None, |
|
|
typing.Optional[bool] |
sources = None |
|
) |
| |
Tracing.start
Start tracing.
**NOTE** You probably want to
[enable tracing in your config file](https://playwright.dev/docs/api/class-testoptions#test-options-trace) instead
of using `Tracing.start`.
The `context.tracing` API captures browser operations and network activity, but it doesn't record test assertions
(like `expect` calls). We recommend
[enabling tracing through Playwright Test configuration](https://playwright.dev/docs/api/class-testoptions#test-options-trace),
which includes those assertions and provides a more complete trace for debugging test failures.
**Usage**
```py
context.tracing.start(screenshots=True, snapshots=True)
page = context.new_page()
page.goto(\"https://playwright.dev\")
context.tracing.stop(path = \"trace.zip\")
```
Parameters
----------
name : Union[str, None]
If specified, intermediate trace files are going to be saved into the files with the given name prefix inside the
`tracesDir` directory specified in `browser_type.launch()`. To specify the final trace zip file name, you
need to pass `path` option to `tracing.stop()` instead.
title : Union[str, None]
Trace name to be shown in the Trace Viewer.
snapshots : Union[bool, None]
If this option is true tracing will
- capture DOM snapshot on every action
- record network activity
screenshots : Union[bool, None]
Whether to capture screenshots during tracing. Screenshots are used to build a timeline preview.
sources : Union[bool, None]
Whether to include source files for trace actions.
◆ start_chunk()
| None playwright.sync_api._generated.Tracing.start_chunk |
( |
|
self, |
|
|
*typing.Optional[str] |
title = None, |
|
|
typing.Optional[str] |
name = None |
|
) |
| |
Tracing.start_chunk
Start a new trace chunk. If you'd like to record multiple traces on the same `BrowserContext`, use
`tracing.start()` once, and then create multiple trace chunks with `tracing.start_chunk()` and
`tracing.stop_chunk()`.
**Usage**
```py
context.tracing.start(screenshots=True, snapshots=True)
page = context.new_page()
page.goto(\"https://playwright.dev\")
context.tracing.start_chunk()
page.get_by_text(\"Get Started\").click()
# Everything between start_chunk and stop_chunk will be recorded in the trace.
context.tracing.stop_chunk(path = \"trace1.zip\")
context.tracing.start_chunk()
page.goto(\"http://example.com\")
# Save a second trace file with different actions.
context.tracing.stop_chunk(path = \"trace2.zip\")
```
Parameters
----------
title : Union[str, None]
Trace name to be shown in the Trace Viewer.
name : Union[str, None]
If specified, intermediate trace files are going to be saved into the files with the given name prefix inside the
`tracesDir` directory specified in `browser_type.launch()`. To specify the final trace zip file name, you
need to pass `path` option to `tracing.stop_chunk()` instead.
◆ stop()
| None playwright.sync_api._generated.Tracing.stop |
( |
|
self, |
|
|
*typing.Optional[typing.Union[pathlib.Path, str]] |
path = None |
|
) |
| |
Tracing.stop
Stop tracing.
Parameters
----------
path : Union[pathlib.Path, str, None]
Export trace into the file with the given path.
◆ stop_chunk()
| None playwright.sync_api._generated.Tracing.stop_chunk |
( |
|
self, |
|
|
*typing.Optional[typing.Union[pathlib.Path, str]] |
path = None |
|
) |
| |
Tracing.stop_chunk
Stop the trace chunk. See `tracing.start_chunk()` for more details about multiple trace chunks.
Parameters
----------
path : Union[pathlib.Path, str, None]
Export trace collected since the last `tracing.start_chunk()` call into the file with the given path.
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/playwright/sync_api/_generated.py