-
Notifications
You must be signed in to change notification settings - Fork 330
Expand file tree
/
Copy pathviews.py
More file actions
83 lines (54 loc) · 1.9 KB
/
Copy pathviews.py
File metadata and controls
83 lines (54 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from typing import Literal, Optional
from pydantic import BaseModel
# Shared config allowing extra fields so recorder payloads pass through
class _BaseExtra(BaseModel):
"""Base model ignoring unknown fields."""
class Config:
extra = 'ignore'
# Mixin for shared step metadata (timestamp and tab context)
class StepMeta(_BaseExtra):
timestamp: int
tabId: int
# Common optional fields present in recorder events
class RecorderBase(StepMeta):
xpath: Optional[str] = None
elementTag: Optional[str] = None
elementText: Optional[str] = None
frameUrl: Optional[str] = None
frameIdPath: Optional[str] = None
url: Optional[str] = None
screenshot: Optional[str] = None
class ClickElementDeterministicAction(RecorderBase):
"""Parameters for clicking an element identified by CSS selector."""
type: Literal['click']
cssSelector: str
class InputTextDeterministicAction(RecorderBase):
"""Parameters for entering text into an input field identified by CSS selector."""
type: Literal['input']
cssSelector: str
value: str
class SelectDropdownOptionDeterministicAction(RecorderBase):
"""Parameters for selecting a dropdown option identified by *selector* and *text*."""
type: Literal['select_change']
cssSelector: str
selectedValue: str
selectedText: str
class KeyPressDeterministicAction(RecorderBase):
"""Parameters for pressing a key on an element identified by CSS selector."""
type: Literal['key_press']
cssSelector: str
key: str
class NavigationAction(_BaseExtra):
"""Parameters for navigating to a URL."""
type: Literal['navigation']
url: str
class ScrollDeterministicAction(_BaseExtra):
"""Parameters for scrolling the page by x/y offsets (pixels)."""
type: Literal['scroll']
scrollX: int = 0
scrollY: int = 0
targetId: Optional[int] = None
class PageExtractionAction(_BaseExtra):
"""Parameters for extracting content from the page."""
type: Literal['extract_page_content']
goal: str