Skip to content

Commit 32bc2da

Browse files
authored
Fix AttributeError crash from calling nonexistent warning method on StagehandLogger (#320)
1 parent 9488f88 commit 32bc2da

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"stagehand": patch
3+
---
4+
5+
Fix AttributeError crash from calling nonexistent `warning` method on StagehandLogger

stagehand/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async def handle_with_lock():
164164
category="context",
165165
)
166166
else:
167-
self.stagehand.logger.warning(
167+
self.stagehand.logger.debug(
168168
"Could not find StagehandPage wrapper for remaining page",
169169
category="context",
170170
)

stagehand/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ async def init(self):
563563
)
564564
self.logger.debug("Set up CDP download behavior")
565565
except Exception as e:
566-
self.logger.warning(f"Failed to set up CDP download behavior: {str(e)}")
566+
self.logger.debug(f"Failed to set up CDP download behavior: {str(e)}")
567567

568568
self._initialized = True
569569

@@ -618,7 +618,7 @@ async def close(self):
618618
f"Error ending server session {self.session_id}: {str(e)}"
619619
)
620620
elif self.session_id:
621-
self.logger.warning(
621+
self.logger.debug(
622622
"Cannot end server session: HTTP client not available."
623623
)
624624

stagehand/page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def ensure_injection(self):
7777
# Ensure that the script is injected on future navigations
7878
await self._page.add_init_script(_INJECTION_SCRIPT)
7979
except TargetClosedError as e:
80-
self._stagehand.logger.warning(
80+
self._stagehand.logger.debug(
8181
f"ensure_injection failed (page may be navigating): {e}",
8282
category="page",
8383
)

0 commit comments

Comments
 (0)