🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
feat(browsers): Add a new option to set browser path
Karim shoair8a4c5ffa3bcc
diff --git a/scrapling/engines/_browsers/_base.py b/scrapling/engines/_browsers/_base.pyindex fa95419..16a995d 100644--- a/scrapling/engines/_browsers/_base.py+++ b/scrapling/engines/_browsers/_base.py@@ -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_pathself._user_data_dir = config.user_data_direlse:diff --git a/scrapling/engines/_browsers/_types.py b/scrapling/engines/_browsers/_types.pyindex f4f31cd..6ab40b9 100644--- a/scrapling/engines/_browsers/_types.py+++ b/scrapling/engines/_browsers/_types.py@@ -90,6 +90,7 @@ class PlaywrightSession(TypedDict, total=False):retries: intretry_delay: int | floatcapture_xhr: str | None+ executable_path: Optional[str]class PlaywrightFetchParams(TypedDict, total=False):diff --git a/scrapling/engines/_browsers/_validators.py b/scrapling/engines/_browsers/_validators.pyindex dfe7310..69b3766 100644--- a/scrapling/engines/_browsers/_validators.py+++ b/scrapling/engines/_browsers/_validators.py@@ -88,6 +88,7 @@ class PlaywrightConfig(Struct, kw_only=True, frozen=False, weakref=True):retries: RetriesCount = 3retry_delay: Seconds = 1capture_xhr: str | None = None+ executable_path: Optional[str] = Nonedef __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