Browsing actions¶
conatus.actions.preloaded.browsing.browser_start
conatus-action
¶
browser_start(
*, headless: bool = True, url: str | None = None
) -> SimpleBrowser
This function is an Action
You can call browser_start just like a regular function, but note that it is
actually a Action object.
This means that:
browser_starthas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Start a browser.
| PARAMETER | DESCRIPTION |
|---|---|
headless
|
Whether to run the browser in headless mode. Defaults to
TYPE:
|
url
|
The URL to go to.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SimpleBrowser
|
The browser. |
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_start_visible
conatus-action
¶
browser_start_visible() -> SimpleBrowser
This function is an Action
You can call browser_start_visible just like a regular function, but note that it is
actually a Action object.
This means that:
browser_start_visiblehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Start a browser that is visible.
| RETURNS | DESCRIPTION |
|---|---|
SimpleBrowser
|
The browser. |
conatus.actions.preloaded.browsing.browser_goto
conatus-action
¶
browser_goto(browser: SimpleBrowser, url: str) -> None
This function is an Action
You can call browser_goto just like a regular function, but note that it is
actually a Action object.
This means that:
browser_gotohas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Go to a URL.
Ultimately, if you provide a URL that is invalid, the browser will throw an error.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
url
|
The URL to go to.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_close
conatus-action
¶
browser_close(browser: SimpleBrowser) -> None
This function is an Action
You can call browser_close just like a regular function, but note that it is
actually a Action object.
This means that:
browser_closehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Close the browser.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to close.
TYPE:
|
conatus.actions.preloaded.browsing.browser_get_page_title
conatus-action
¶
browser_get_page_title(browser: SimpleBrowser) -> str
This function is an Action
You can call browser_get_page_title just like a regular function, but note that it is
actually a Action object.
This means that:
browser_get_page_titlehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Get the title of the current page.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The title of the current page. |
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_page_html
conatus-action
¶
browser_page_html(browser: SimpleBrowser) -> HTML
This function is an Action
You can call browser_page_html just like a regular function, but note that it is
actually a Action object.
This means that:
browser_page_htmlhas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Grab the browser's fully-rendered HTML as a parseable object.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser whose current page to capture.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
HTML
|
The rendered page. |
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.list_clickable_nodes
conatus-action
¶
list_clickable_nodes(
browser: SimpleBrowser, min_text_length: int = 0
) -> str
This function is an Action
You can call list_clickable_nodes just like a regular function, but note that it is
actually a Action object.
This means that:
list_clickable_nodeshas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
List the current page's clickable nodes as a readable text table.
Gives the model a reliable handle on what it can click. Each row is
[id] <tag> 'text' · key=val, where id is exactly the id accepted by
add_nodes_to_set
and browser_click_node
. Reading these ids
off this table is more reliable than reading the numbers off the screenshot.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser whose current page to inspect.
TYPE:
|
min_text_length
|
If greater than 0, omit nodes whose visible text is shorter than this -- a generic way to hide icon-only / chrome links. Defaults to 0, which lists every clickable node.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A newline-separated table of clickable nodes, or a notice if none qualify. |
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_do_nothing
conatus-action
¶
browser_do_nothing(
browser: SimpleBrowser, *, seconds: float | None = None
) -> None
This function is an Action
You can call browser_do_nothing just like a regular function, but note that it is
actually a Action object.
This means that:
browser_do_nothinghas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Do nothing.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
seconds
|
The number of seconds to wait.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_click
conatus-action
¶
browser_click(
browser: SimpleBrowser,
x: float,
y: float,
*,
button: ExtendedMouseButton = "left",
click_count: int = 1
) -> None
This function is an Action
You can call browser_click just like a regular function, but note that it is
actually a Action object.
This means that:
browser_clickhas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Click on an element at a given position.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
x
|
The x coordinate of the element to click.
TYPE:
|
y
|
The y coordinate of the element to click.
TYPE:
|
button
|
The button to click on. Defaults to
TYPE:
|
click_count
|
The number of clicks to perform. Defaults to
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_click_node
conatus-action
¶
browser_click_node(
browser: SimpleBrowser, node_id: int
) -> None
This function is an Action
You can call browser_click_node just like a regular function, but note that it is
actually a Action object.
This means that:
browser_click_nodehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Click on a node.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
node_id
|
The id of the node to click on.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.add_nodes_to_set
conatus-action
¶
add_nodes_to_set(
browser: SimpleBrowser,
node_ids: set[int],
existing_set: Existing[set[DOMNode]] | None = None,
) -> Existing[set[DOMNode]]
This function is an Action
You can call add_nodes_to_set just like a regular function, but note that it is
actually a Action object.
This means that:
add_nodes_to_sethas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Add nodes to a (potentially pre-existing) set.
Ids that aren't currently clickable on the page are silently skipped rather than raising.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
node_ids
|
The ids of the nodes to add. |
existing_set
|
The set to add the nodes to. If not provided, a new set will be created. |
| RETURNS | DESCRIPTION |
|---|---|
set[DOMNode]
|
The set of nodes. |
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_mousedown
conatus-action
¶
browser_mousedown(
browser: SimpleBrowser,
*,
x: float | None = None,
y: float | None = None,
button: MouseButton = "left"
) -> None
This function is an Action
You can call browser_mousedown just like a regular function, but note that it is
actually a Action object.
This means that:
browser_mousedownhas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Mouse down on an element at a given position.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
x
|
The x coordinate of the element to click.
TYPE:
|
y
|
The y coordinate of the element to click.
TYPE:
|
button
|
The button to click on. Defaults to
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_mouseup
conatus-action
¶
browser_mouseup(
browser: SimpleBrowser,
*,
x: float | None = None,
y: float | None = None,
button: MouseButton = "left"
) -> None
This function is an Action
You can call browser_mouseup just like a regular function, but note that it is
actually a Action object.
This means that:
browser_mouseuphas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Mouse up on an element at a given position.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
x
|
The x coordinate of the element to click.
TYPE:
|
y
|
The y coordinate of the element to click.
TYPE:
|
button
|
The button to click on. Defaults to
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_mouse_move
conatus-action
¶
browser_mouse_move(
browser: SimpleBrowser, x: float, y: float
) -> None
This function is an Action
You can call browser_mouse_move just like a regular function, but note that it is
actually a Action object.
This means that:
browser_mouse_movehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Move the mouse to a given position.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
x
|
The x coordinate of the element to click.
TYPE:
|
y
|
The y coordinate of the element to click.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_drag
conatus-action
¶
browser_drag(
browser: SimpleBrowser, path: list[tuple[float, float]]
) -> None
This function is an Action
You can call browser_drag just like a regular function, but note that it is
actually a Action object.
This means that:
browser_draghas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Drag the mouse.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
path
|
The path to drag the mouse to. |
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_scroll
conatus-action
¶
browser_scroll(
browser: SimpleBrowser,
direction: ScrollDirection,
*,
magnitude_px: int | None = None,
magnitude_relative: float | None = None
) -> None
This function is an Action
You can call browser_scroll just like a regular function, but note that it is
actually a Action object.
This means that:
browser_scrollhas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Scroll the browser.
Unless you know what you are doing, you should use the magnitude_relative
argument.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
direction
|
The direction to scroll.
TYPE:
|
magnitude_px
|
The magnitude to scroll.
TYPE:
|
magnitude_relative
|
The magnitude to scroll relative to the current viewport size.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_scroll_precise
conatus-action
¶
browser_scroll_precise(
browser: SimpleBrowser,
delta_x: float,
delta_y: float,
*,
start_x: float | None = None,
start_y: float | None = None
) -> None
This function is an Action
You can call browser_scroll_precise just like a regular function, but note that it is
actually a Action object.
This means that:
browser_scroll_precisehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Scroll the browser precisely.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
delta_x
|
The x coordinate of the scroll distance.
TYPE:
|
delta_y
|
The y coordinate of the scroll distance.
TYPE:
|
start_x
|
The x coordinate to start scrolling from.
TYPE:
|
start_y
|
The y coordinate to start scrolling from.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_keypress
conatus-action
¶
browser_keypress(
browser: SimpleBrowser,
keys: list[str],
*,
duration: float = 0
) -> None
This function is an Action
You can call browser_keypress just like a regular function, but note that it is
actually a Action object.
This means that:
browser_keypresshas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Press keys into the page.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
keys
|
The keys to press. |
duration
|
The duration to hold the key.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.browser_type
conatus-action
¶
browser_type(browser: SimpleBrowser, text: str) -> None
This function is an Action
You can call browser_type just like a regular function, but note that it is
actually a Action object.
This means that:
browser_typehas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Type text into the page.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser to use.
TYPE:
|
text
|
The text to type.
TYPE:
|
Source code in conatus/actions/preloaded/browsing.py
conatus.actions.preloaded.browsing.inspect_at
conatus-action
¶
inspect_at(
browser: SimpleBrowser, x: float, y: float
) -> str
This function is an Action
You can call inspect_at just like a regular function, but note that it is
actually a Action object.
This means that:
inspect_athas additional properties and methods that you can use (see theActiondocumentation for more information);- but it also means that operations like
issubclassandisinstancewill not work as expected.
Describe the DOM element at screen point (x, y).
Like a dev-tools inspector: uses the page's already-detected nodes (no extra CDP round-trip) to find the smallest (most specific) node whose bounding box covers the point. Handy for turning "the thing at this spot on the screenshot" into a concrete element.
| PARAMETER | DESCRIPTION |
|---|---|
browser
|
The browser whose current page to inspect.
TYPE:
|
x
|
Horizontal screen coordinate (pixels).
TYPE:
|
y
|
Vertical screen coordinate (pixels).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A one-line description (tag, visible text, identifying attributes) of the element at that point, or a notice if none covers it. |