22
33from __future__ import annotations
44
5- from typing import Dict , List , Union , Optional
6- from typing_extensions import Literal , Required , TypeAlias , TypedDict
5+ from typing import Dict , List , Union , Iterable , Optional
6+ from typing_extensions import Literal , Required , Annotated , TypeAlias , TypedDict
77
88from .._types import SequenceNotStr
9+ from .._utils import PropertyInfo
910from .retry_config_param import RetryConfigParam
1011
1112__all__ = [
1213 "MonitorCreateParams" ,
1314 "Target" ,
1415 "TargetMonitorsPageTarget" ,
16+ "TargetMonitorsPageTargetAction" ,
17+ "TargetMonitorsPageTargetActionWebScrapeWaitAction" ,
18+ "TargetMonitorsPageTargetActionWebScrapePerformAction" ,
19+ "TargetMonitorsPageTargetActionWebScrapeScrollAction" ,
1520 "TargetMonitorsSitemapTarget" ,
1621 "TargetMonitorsExtractTarget" ,
1722 "ChangeDetection" ,
@@ -53,6 +58,60 @@ class MonitorCreateParams(TypedDict, total=False):
5358 """Webhook destination and delivery settings. Null means no webhook is configured."""
5459
5560
61+ class TargetMonitorsPageTargetActionWebScrapeWaitAction (TypedDict , total = False ):
62+ """Pause for a fixed number of milliseconds before continuing to the next action."""
63+
64+ do : Required [Literal ["wait" ]]
65+ """Use `wait` to pause for a fixed duration."""
66+
67+ time_ms : Required [Annotated [int , PropertyInfo (alias = "timeMs" )]]
68+ """Time to pause in milliseconds before the next action."""
69+
70+
71+ class TargetMonitorsPageTargetActionWebScrapePerformAction (TypedDict , total = False ):
72+ """Resolve and perform one natural-language browser action."""
73+
74+ action : Required [str ]
75+ """One browser instruction, such as clicking a button or entering text."""
76+
77+ do : Required [Literal ["perform" ]]
78+ """Use `perform` for a plain-language browser instruction."""
79+
80+
81+ class TargetMonitorsPageTargetActionWebScrapeScrollAction (TypedDict , total = False ):
82+ """
83+ Scroll the page or a selected scrollable container, waiting adaptively for content and dimensions to settle after each iteration.
84+ """
85+
86+ do : Required [Literal ["scroll" ]]
87+ """Use `scroll` to move through the page or a container."""
88+
89+ amount : Union [int , Literal ["viewport" , "max" ]]
90+ """Pixels per scroll, one visible viewport, or the current scroll boundary.
91+
92+ Defaults to viewport.
93+ """
94+
95+ container : str
96+ """CSS selector for the first matching scroll container. Defaults to the page."""
97+
98+ direction : Literal ["up" , "down" , "left" , "right" ]
99+ """Direction to scroll. Defaults to down."""
100+
101+ max_scrolls : Annotated [int , PropertyInfo (alias = "maxScrolls" )]
102+ """Maximum scroll iterations.
103+
104+ Stops early when scrolling and scrollable extent stop changing. Defaults to 1.
105+ """
106+
107+
108+ TargetMonitorsPageTargetAction : TypeAlias = Union [
109+ TargetMonitorsPageTargetActionWebScrapeWaitAction ,
110+ TargetMonitorsPageTargetActionWebScrapePerformAction ,
111+ TargetMonitorsPageTargetActionWebScrapeScrollAction ,
112+ ]
113+
114+
56115class TargetMonitorsPageTarget (TypedDict , total = False ):
57116 """Watch a single web page.
58117
@@ -65,6 +124,13 @@ class TargetMonitorsPageTarget(TypedDict, total=False):
65124 url : Required [str ]
66125 """Public HTTP(S) page URL to monitor."""
67126
127+ actions : Optional [Iterable [TargetMonitorsPageTargetAction ]]
128+ """
129+ Optional browser actions executed in array order after the page loads, before
130+ content is captured, on every run. Requires a paid plan. Maximum: 5 actions.
131+ Changes create a new baseline.
132+ """
133+
68134 exclude_selectors : SequenceNotStr [str ]
69135 """Remove matching regions after inclusions. Changes create a new baseline."""
70136
0 commit comments