feat(browsers): Add a new option to set browser path

Solves #202
This commit is contained in:
Karim shoair
2026-03-30 03:06:58 +02:00
parent 6598664f55
commit 8a4c5ffa3b
3 changed files with 9 additions and 0 deletions
+2
View File
@@ -458,6 +458,8 @@ class BaseSessionMixin:
"channel": "chrome" if config.real_chrome else "chromium",
}
)
if config.executable_path:
self._browser_options["executable_path"] = config.executable_path
self._user_data_dir = config.user_data_dir
else:
+1
View File
@@ -90,6 +90,7 @@ class PlaywrightSession(TypedDict, total=False):
retries: int
retry_delay: int | float
capture_xhr: str | None
executable_path: Optional[str]
class PlaywrightFetchParams(TypedDict, total=False):
@@ -88,6 +88,7 @@ class PlaywrightConfig(Struct, kw_only=True, frozen=False, weakref=True):
retries: RetriesCount = 3
retry_delay: Seconds = 1
capture_xhr: str | None = None
executable_path: Optional[str] = None
def __post_init__(self): # pragma: no cover
"""Custom validation after msgspec validation"""
@@ -121,6 +122,11 @@ class PlaywrightConfig(Struct, kw_only=True, frozen=False, weakref=True):
if validation_msg:
raise ValueError(validation_msg)
if self.executable_path is not None:
validation_msg = _is_invalid_file_path(self.executable_path)
if validation_msg:
raise ValueError(validation_msg)
class StealthConfig(PlaywrightConfig, kw_only=True, frozen=False, weakref=True):
allow_webgl: bool = True