mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 08:41:53 +09:00
35 lines
No EOL
1.1 KiB
Text
35 lines
No EOL
1.1 KiB
Text
from browser_use.browser.context import BrowserContextConfig
|
|
from pathlib import Path
|
|
import os
|
|
|
|
from typing import Any
|
|
|
|
def browser_config_kwargs(lang: str = "en_US") -> dict[str, Any]:
|
|
browser_config_kwargs: dict[str, Any] = {
|
|
"keep_alive": True,
|
|
"browser_type": "chromium",
|
|
"headless": False,
|
|
"disable_security": True,
|
|
"extra_browser_args": [
|
|
"--disable-web-security",
|
|
"--disable-features=VizDisplayCompositor",
|
|
"--disable-site-isolation-trials",
|
|
"--disable-features=IsolateOrigins,site-per-process",
|
|
"--disable-popup-blocking",
|
|
"--disable-dev-shm-usage",
|
|
f"--lang={lang}",
|
|
"--ignore-certificate-errors",
|
|
"--ignore-ssl-errors",
|
|
"--allow-running-insecure-content"
|
|
],
|
|
}
|
|
|
|
proxy_host = os.getenv("PROXY_HOST")
|
|
proxy_port = os.getenv("PROXY_PORT")
|
|
if proxy_host and proxy_port:
|
|
browser_config_kwargs["extra_browser_args"].append(
|
|
f"--proxy-server=http={proxy_host}:{proxy_port};https={proxy_host}:{proxy_port}"
|
|
)
|
|
|
|
return browser_config_kwargs
|
|
|