fix(browser)!: default to Chromium channel for new headless mode (#387)
BREAKING CHANGE: Updated `chrome_channel` to "chromium" to fix compatibility with the new Chromium headless implementation. This resolves the error `playwright._impl._errors.Error: BrowserType.launch: Chromium distribution 'chrome' is not found`, caused by the removal of the old headless mode in Chromium. With this change, channels like "chrome" and "msedge" now default to the new headless mode, aligning with upstream updates in Playwright v1.49. The new headless mode uses the real Chrome browser, offering more authenticity, reliability, and feature parity with the full browser. Additionally, simplified fallback logic by directly assigning `chrome_channel` based on `browser_type` or defaulting to "chromium". Refer to: - https://playwright.dev/python/docs/browsers#chromium - https://github.com/microsoft/playwright/issues/33566
This commit is contained in:
@@ -77,7 +77,7 @@ class BrowserConfig:
|
|||||||
use_managed_browser: bool = False,
|
use_managed_browser: bool = False,
|
||||||
use_persistent_context: bool = False,
|
use_persistent_context: bool = False,
|
||||||
user_data_dir: str = None,
|
user_data_dir: str = None,
|
||||||
chrome_channel: str = "chrome",
|
chrome_channel: str = "chromium",
|
||||||
proxy: str = None,
|
proxy: str = None,
|
||||||
proxy_config: dict = None,
|
proxy_config: dict = None,
|
||||||
viewport_width: int = 1080,
|
viewport_width: int = 1080,
|
||||||
@@ -107,14 +107,10 @@ class BrowserConfig:
|
|||||||
self.use_managed_browser = use_managed_browser
|
self.use_managed_browser = use_managed_browser
|
||||||
self.use_persistent_context = use_persistent_context
|
self.use_persistent_context = use_persistent_context
|
||||||
self.user_data_dir = user_data_dir
|
self.user_data_dir = user_data_dir
|
||||||
if self.browser_type == "chromium":
|
|
||||||
self.chrome_channel = "chrome"
|
# Directly assign browser_type to chrome_channel, with fallback to default
|
||||||
elif self.browser_type == "firefox":
|
self.chrome_channel = chrome_channel or self.browser_type or "chromium"
|
||||||
self.chrome_channel = "firefox"
|
|
||||||
elif self.browser_type == "webkit":
|
|
||||||
self.chrome_channel = "webkit"
|
|
||||||
else:
|
|
||||||
self.chrome_channel = chrome_channel or "chrome"
|
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
self.proxy_config = proxy_config
|
self.proxy_config = proxy_config
|
||||||
self.viewport_width = viewport_width
|
self.viewport_width = viewport_width
|
||||||
|
|||||||
Reference in New Issue
Block a user