Skip to content

Commit 9c9384f

Browse files
authored
fix Stagehand headless mode (#236)
* fix Stagehand headless mode * fix formatting
1 parent 061c50c commit 9c9384f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

stagehand/browser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ async def connect_local_browser(
182182

183183
# Prepare Launch Options (translate keys if needed)
184184
launch_options = {
185-
"headless": local_browser_launch_options.get("headless", False),
185+
"headless": local_browser_launch_options.get(
186+
"headless", stagehand_instance.config.headless
187+
),
186188
"accept_downloads": local_browser_launch_options.get(
187189
"acceptDownloads", True
188190
),

stagehand/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class StagehandConfig(BaseModel):
7070
alias="domSettleTimeoutMs",
7171
description="Timeout for DOM to settle (in ms)",
7272
)
73+
headless: bool = Field(False, description="Run browser in headless mode")
7374
browserbase_session_create_params: Optional[dict[str, Any]] = Field(
7475
None,
7576
alias="browserbaseSessionCreateParams",

0 commit comments

Comments
 (0)