Skip to content

common_browser.schemas.configs.operations

Validated operation bounds, browser commands and event expectations.

Classes

Action

Bases: BaseModel

One explicit browser action; values and destinations stay out of repr.

Fields and properties declared here; inherited members belong to the bases above.

button

button: Literal['left', 'middle', 'right'] = 'left'

checked

checked: bool = True

delay_ms

delay_ms: float = Field(default=0, ge=0, allow_inf_nan=False)

destination

destination: Target | ElementRef | None = Field(default=None, repr=False)

files

files: tuple[Path | UploadFile, ...] = Field(default=(), repr=False)

indices

indices: tuple[Annotated[int, Field(ge=0, strict=True)], ...] | None = Field(default=None, repr=False)

kind

kind: Literal['goto', 'back', 'forward', 'reload', 'click', 'double_click', 'fill', 'type', 'press', 'hover', 'check', 'select', 'scroll', 'drag', 'upload', 'wait', 'wait_for_load']

labels

labels: tuple[str, ...] | None = Field(default=None, repr=False)

state

state: Literal['visible', 'hidden', 'attached', 'detached'] = 'visible'

target

target: Target | ElementRef | None = Field(default=None, repr=False)

value

value: str | None = Field(default=None, repr=False)

values

values: tuple[str, ...] | None = Field(default=None, repr=False)

wait_until

wait_until: Literal['commit', 'domcontentloaded', 'load', 'networkidle'] = 'domcontentloaded'

x

x: float = 0

y

y: float = 0

click

@classmethod
def click(target: Target | ElementRef, *, button: Literal['left', 'middle', 'right'] = 'left') -> Self

fill

@classmethod
def fill(target: Target | ElementRef, value: str) -> Self

goto

@classmethod
def goto(url: str, *, wait_until: Literal['commit', 'domcontentloaded', 'load', 'networkidle'] = 'domcontentloaded') -> Self

EventWait

Bases: BaseModel

One bounded event match, armed before dispatch or consumed by a watch.

url is an exact URL or a shell-style glob, evaluated on observed events. Dialogs default to dismiss; choose accept explicitly for confirmations. Download destinations always refer to the consumer’s filesystem. max_bytes bounds retained event text/URLs and completed download size; oversized callback URLs are rejected, never truncated into usable callbacks.

Fields and properties declared here; inherited members belong to the bases above.

accept

accept: bool = False

capacity

capacity: int = Field(default=128, gt=0, le=10000)

header_names

header_names: tuple[str, ...] = ()

include_body

include_body: bool = False

kind

kind: Literal['navigation', 'request', 'response', 'popup', 'download', 'dialog', 'console']

max_bytes

max_bytes: int = Field(default=(32 * 1024 * 1024), gt=0)

method

method: str | None = None

prompt

prompt: str | None = Field(default=None, repr=False)

status

status: int | None = Field(default=None, ge=100, le=599)

to

to: Path | None = Field(default=None, repr=False)

url

url: str | None = Field(default=None, repr=False)

dialog

@classmethod
def dialog(*, accept: bool = False, prompt: str | None = None) -> Self

download

@classmethod
def download(*, to: Path | str, max_bytes: int = 32 * 1024 * 1024) -> Self
@classmethod
def navigation(url: str | None = None) -> Self
@classmethod
def popup() -> Self

request

@classmethod
def request(url: str | None = None, *, method: str | None = None, header_names: tuple[str, ...] = (), include_body: bool = False, max_bytes: int = 32 * 1024 * 1024) -> Self

response

@classmethod
def response(url: str | None = None, *, status: int | None = None, header_names: tuple[str, ...] = (), include_body: bool = False, max_bytes: int = 32 * 1024 * 1024) -> Self

OperationConfig

Bases: BaseModel

One operation deadline, in seconds; no browser action replay is implied.

Fields and properties declared here; inherited members belong to the bases above.

deadline

deadline: float | None = Field(default=None, allow_inf_nan=False)

timeout

timeout: float = Field(default=30.0, gt=0, allow_inf_nan=False)

UploadFile

Bases: BaseModel

One supplied in-memory file; only explicit SDK export reveals its bytes.

Fields and properties declared here; inherited members belong to the bases above.

content

content: SecretBytes = Field(repr=False)

mime_type

mime_type: str = Field(default='application/octet-stream', repr=False)

name

name: str = Field(min_length=1, max_length=255, repr=False)

export

def export() -> dict[str, str | bytes]

Explicitly reveal the validated SDK payload at the upload boundary.