fix: support PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH env var for NixOS
This commit is contained in:
@@ -14,6 +14,8 @@ class Browser:
|
||||
self._page: Any = None
|
||||
|
||||
def start(self) -> None:
|
||||
import os
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
self._pw = sync_playwright().start()
|
||||
@@ -23,6 +25,8 @@ class Browser:
|
||||
}
|
||||
if self._proxy_port is not None:
|
||||
launch_kwargs["proxy"] = {"server": f"http://127.0.0.1:{self._proxy_port}"}
|
||||
if exe_path := os.environ.get("PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH"):
|
||||
launch_kwargs["executable_path"] = exe_path
|
||||
self._browser = self._pw.chromium.launch(**launch_kwargs)
|
||||
context = self._browser.new_context(ignore_https_errors=True)
|
||||
self._page = context.new_page()
|
||||
|
||||
Reference in New Issue
Block a user