Skip to content

Commit 133d554

Browse files
AHarmlessPyroclaude
andcommitted
Accept tab_opened session events
The API has sent tab_opened events since browserctrl #559, and the event type Literal refused them, so listing such a session's events failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019dbwbLvQGyzwkxNetvqf3v
1 parent 5a8ef8d commit 133d554

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎hyperbrowser/models/consts.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"captcha_solved",
2626
"captcha_error",
2727
"file_downloaded",
28+
"tab_opened",
2829
"credential_filled",
2930
"credential_fill_refused",
3031
]

‎tests/test_session_event_logs.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pytest
2+
3+
from hyperbrowser.models.session import SessionEventLog
4+
5+
6+
@pytest.mark.parametrize(
7+
"event_type", ["tab_opened", "credential_filled", "credential_fill_refused"]
8+
)
9+
def test_event_log_types_the_api_sends_parse(event_type):
10+
event = SessionEventLog.model_validate(
11+
{
12+
"id": "e1",
13+
"sessionId": "s1",
14+
"targetId": None,
15+
"pageUrl": "https://example.com/",
16+
"teamId": "t1",
17+
"type": event_type,
18+
"metadata": {},
19+
"timestamp": 1,
20+
}
21+
)
22+
assert event.type == event_type

0 commit comments

Comments
 (0)