mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
Set is local to false by default
This commit is contained in:
@@ -536,11 +536,10 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro
|
||||
|
||||
# Session/connection configuration
|
||||
cdp_url: str | None = Field(default=None, description='CDP URL for connecting to existing browser instance')
|
||||
is_local: bool = Field(default=True, description='Whether this is a local browser instance')
|
||||
is_local: bool = Field(default=False, description='Whether this is a local browser instance')
|
||||
# label: str = 'default'
|
||||
|
||||
# custom options we provide that aren't native playwright kwargs
|
||||
stealth: bool = Field(default=False, description='Use stealth mode to avoid detection by anti-bot systems.')
|
||||
disable_security: bool = Field(default=False, description='Disable browser security features.')
|
||||
deterministic_rendering: bool = Field(default=False, description='Enable deterministic rendering flags.')
|
||||
allowed_domains: list[str] | None = Field(
|
||||
|
||||
@@ -203,7 +203,6 @@ class BrowserSession(BaseModel):
|
||||
|
||||
# Access session fields directly, browser settings via profile or property
|
||||
print(session.id) # Session field
|
||||
print(session.browser_profile.stealth) # Direct browser_profile access
|
||||
```
|
||||
"""
|
||||
|
||||
@@ -219,7 +218,7 @@ class BrowserSession(BaseModel):
|
||||
# Core configuration
|
||||
id: str | None = None,
|
||||
cdp_url: str | None = None,
|
||||
is_local: bool = True,
|
||||
is_local: bool = False,
|
||||
browser_profile: BrowserProfile | None = None,
|
||||
# BrowserProfile fields that can be passed directly
|
||||
# From BrowserConnectArgs
|
||||
@@ -252,7 +251,6 @@ class BrowserSession(BaseModel):
|
||||
# From BrowserNewContextArgs
|
||||
storage_state: str | Path | dict[str, Any] | None = None,
|
||||
# BrowserProfile specific fields
|
||||
stealth: bool | None = None,
|
||||
disable_security: bool | None = None,
|
||||
deterministic_rendering: bool | None = None,
|
||||
allowed_domains: list[str] | None = None,
|
||||
@@ -273,6 +271,10 @@ class BrowserSession(BaseModel):
|
||||
# Only pass non-None values to avoid validation errors
|
||||
profile_kwargs = {k: v for k, v in locals().items() if k not in ['self', 'browser_profile', 'id'] and v is not None}
|
||||
|
||||
# if is_local is False but executable_path is provided, set is_local to True
|
||||
if is_local is False and executable_path is not None:
|
||||
profile_kwargs['is_local'] = True
|
||||
|
||||
# Create browser profile from direct parameters or use provided one
|
||||
if browser_profile is not None:
|
||||
# Merge any direct kwargs into the provided browser_profile (direct kwargs take precedence)
|
||||
|
||||
@@ -71,7 +71,6 @@ async def run_single_task(task_file):
|
||||
headless=True,
|
||||
user_data_dir=None,
|
||||
chromium_sandbox=False, # Disable sandbox for CI environment (GitHub Actions)
|
||||
stealth=True, #
|
||||
)
|
||||
session = BrowserSession(browser_profile=profile)
|
||||
print('[DEBUG] Browser session created', file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user