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: 1 addition & 1 deletion DRIVER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
049226728d2da8054db18b04782a9848b755855e
b0e0b7b555e637cc8c0ce94dd98c3be153861333
4 changes: 4 additions & 0 deletions playwright/_impl/browser_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ async def launch(

# Not ported: the logger option (JavaScript only).
options = {**(self._playwright._default_launch_options or {}), **options}
if options.get("traces_dir"):
options["traces_dir"] = os.path.abspath(options["traces_dir"])
launch_options = to_launch_params(options)
browser = Browser.from_(
(
Expand Down Expand Up @@ -289,6 +291,8 @@ async def launch_persistent_context(
**options,
}
)
if options.get("traces_dir"):
options["traces_dir"] = os.path.abspath(options["traces_dir"])
await self._instrumentation.run_before_create_browser_context(options)

# Not ported: the logger option (JavaScript only).
Expand Down
14 changes: 6 additions & 8 deletions playwright/_impl/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ async def new_context(
else options.get("storage_state")
)
default_launch_options = self._playwright._default_launch_options
default_traces_dir = (
default_launch_options.get("traces_dir") if default_launch_options else None
)
traces_dir = os.path.abspath(default_traces_dir) if default_traces_dir else None
context = APIRequestContext.from_(
(
await self._playwright._channel.newRequest(
Expand Down Expand Up @@ -178,11 +182,7 @@ async def new_context(
storage_state,
),
# We do not expose tracesDir in the API, so do not allow options to accidentally override it.
tracesDir=(
default_launch_options.get("traces_dir")
if default_launch_options
else None
),
tracesDir=traces_dir,
timeout=NO_TIMEOUT,
)
)["request"]
Expand All @@ -195,9 +195,7 @@ async def new_context(
if context_timeout is not None
else self._playwright._default_context_timeout
)
context.tracing._traces_dir = (
default_launch_options.get("traces_dir") if default_launch_options else None
)
context.tracing._traces_dir = traces_dir
await context._instrumentation.run_after_create_request_context(context)
return context

Expand Down
3 changes: 2 additions & 1 deletion playwright/_impl/har_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""

import base64
import os
from typing import TYPE_CHECKING, Dict, Literal, Optional, cast

from playwright._impl.errors import Error
Expand All @@ -43,7 +44,7 @@ async def create(
not_found_action: HarNotFoundAction,
url_match: Optional[URLMatch],
) -> "HarRouter":
result = await local_utils.har_open({"file": file})
result = await local_utils.har_open({"file": os.path.abspath(file)})
har_id, error = result["harId"], result["error"]
if error:
raise Error(error)
Expand Down
Loading
Loading