Skip to content

Commit 77be2c2

Browse files
feat: [feat]: add ignoreSelectors to observe()
1 parent ce22a97 commit 77be2c2

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-49b40c7425adba9e67fc102838c5216c45ca1f7ef4c10823c5665fd413538504.yml
3-
openapi_spec_hash: 6880dc029df2e88dfe8943c0dec5a3a5
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-eae8400fade7b2c8329c4148f56de92e147c34c0feecb420c015aab6544a9acc.yml
3+
openapi_spec_hash: 0a9eff1ac1d464e89cbd9db64709b08a
44
config_hash: 1fb12ae9b478488bc1e56bfbdc210b01

src/stagehand/types/session_observe_params.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Dict, Union, Optional
66
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
77

8+
from .._types import SequenceNotStr
89
from .._utils import PropertyInfo
910
from .model_config_param import ModelConfigParam
1011

@@ -45,6 +46,9 @@ class OptionsVariablesUnionMember3(TypedDict, total=False):
4546

4647

4748
class Options(TypedDict, total=False):
49+
ignore_selectors: Annotated[SequenceNotStr[str], PropertyInfo(alias="ignoreSelectors")]
50+
"""Selectors for elements and subtrees that should be excluded from observation"""
51+
4852
model: OptionsModel
4953
"""Model configuration object or model name string (e.g., 'openai/gpt-5-nano')"""
5054

tests/api_resources/test_sessions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ def test_method_observe_with_all_params_overload_1(self, client: Stagehand) -> N
645645
frame_id="frameId",
646646
instruction="Find all clickable navigation links",
647647
options={
648+
"ignore_selectors": ["nav", ".cookie-banner", "#sidebar-ads"],
648649
"model": {
649650
"model_name": "openai/gpt-5.4-mini",
650651
"api_key": "sk-some-openai-api-key",
@@ -719,6 +720,7 @@ def test_method_observe_with_all_params_overload_2(self, client: Stagehand) -> N
719720
frame_id="frameId",
720721
instruction="Find all clickable navigation links",
721722
options={
723+
"ignore_selectors": ["nav", ".cookie-banner", "#sidebar-ads"],
722724
"model": {
723725
"model_name": "openai/gpt-5.4-mini",
724726
"api_key": "sk-some-openai-api-key",
@@ -1579,6 +1581,7 @@ async def test_method_observe_with_all_params_overload_1(self, async_client: Asy
15791581
frame_id="frameId",
15801582
instruction="Find all clickable navigation links",
15811583
options={
1584+
"ignore_selectors": ["nav", ".cookie-banner", "#sidebar-ads"],
15821585
"model": {
15831586
"model_name": "openai/gpt-5.4-mini",
15841587
"api_key": "sk-some-openai-api-key",
@@ -1653,6 +1656,7 @@ async def test_method_observe_with_all_params_overload_2(self, async_client: Asy
16531656
frame_id="frameId",
16541657
instruction="Find all clickable navigation links",
16551658
options={
1659+
"ignore_selectors": ["nav", ".cookie-banner", "#sidebar-ads"],
16561660
"model": {
16571661
"model_name": "openai/gpt-5.4-mini",
16581662
"api_key": "sk-some-openai-api-key",

0 commit comments

Comments
 (0)