Skip to content

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_start has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Start a browser.

PARAMETER DESCRIPTION
headless

Whether to run the browser in headless mode. Defaults to True.

TYPE: bool DEFAULT: True

url

The URL to go to.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
SimpleBrowser

The browser.

Source code in conatus/actions/preloaded/browsing.py
@action
def browser_start(
    *, headless: bool = True, url: str | None = None
) -> SimpleBrowser:
    """Start a browser.

    Args:
        headless: Whether to run the browser in headless mode. Defaults to
            `True`.
        url: The URL to go to.

    Returns:
        (SimpleBrowser): The browser.
    """
    browser = SimpleBrowser(headless=headless)
    if url:
        browser = browser.goto(url)
    return browser

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_visible has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Start a browser that is visible.

RETURNS DESCRIPTION
SimpleBrowser

The browser.

Source code in conatus/actions/preloaded/browsing.py
@action
def browser_start_visible() -> SimpleBrowser:  # pragma: no cover
    """Start a browser that is visible.

    Returns:
        (SimpleBrowser): The browser.
    """
    return SimpleBrowser(headless=False)

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_goto has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will 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: SimpleBrowser

url

The URL to go to.

TYPE: str

Source code in conatus/actions/preloaded/browsing.py
@action(force_update_on="browser")
def browser_goto(browser: SimpleBrowser, url: str) -> None:
    """Go to a URL.

    Ultimately, if you provide a URL that is invalid, the browser will
    throw an error.

    Args:
        browser: The browser to use.
        url: The URL to go to.
    """
    _ = browser.goto(url)

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_close has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Close the browser.

PARAMETER DESCRIPTION
browser

The browser to close.

TYPE: SimpleBrowser

Source code in conatus/actions/preloaded/browsing.py
@action
def browser_close(browser: SimpleBrowser) -> None:
    """Close the browser.

    Args:
        browser: The browser to close.
    """
    _ = browser.close()

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_title has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Get the title of the current page.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

RETURNS DESCRIPTION
str

The title of the current page.

Source code in conatus/actions/preloaded/browsing.py
@action
def browser_get_page_title(browser: SimpleBrowser) -> str:
    """Get the title of the current page.

    Args:
        browser: The browser to use.

    Returns:
        (str): The title of the current page.
    """
    return browser.page_title

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_nothing has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Do nothing.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

seconds

The number of seconds to wait.

TYPE: float | None DEFAULT: None

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_do_nothing(
    browser: SimpleBrowser, *, seconds: float | None = None
) -> None:
    """Do nothing.

    Args:
        browser: The browser to use.
        seconds: The number of seconds to wait.
    """
    if seconds is not None:
        time.sleep(seconds)
    _ = browser

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_click has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Click on an element at a given position.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

x

The x coordinate of the element to click.

TYPE: float

y

The y coordinate of the element to click.

TYPE: float

button

The button to click on. Defaults to "left".

TYPE: ExtendedMouseButton DEFAULT: 'left'

click_count

The number of clicks to perform. Defaults to 1.

TYPE: int DEFAULT: 1

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_click(
    browser: SimpleBrowser,
    x: float,
    y: float,
    *,
    button: ExtendedMouseButton = "left",
    click_count: int = 1,
) -> None:
    """Click on an element at a given position.

    Args:
        browser: The browser to use.
        x: The x coordinate of the element to click.
        y: The y coordinate of the element to click.
        button: The button to click on. Defaults to `"left"`.
        click_count: The number of clicks to perform. Defaults to `1`.
    """
    _ = browser.click(x, y, button=button, click_count=click_count)

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_mousedown has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Mouse down on an element at a given position.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

x

The x coordinate of the element to click.

TYPE: float | None DEFAULT: None

y

The y coordinate of the element to click.

TYPE: float | None DEFAULT: None

button

The button to click on. Defaults to "left".

TYPE: MouseButton DEFAULT: 'left'

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_mousedown(
    browser: SimpleBrowser,
    *,
    x: float | None = None,
    y: float | None = None,
    button: MouseButton = "left",
) -> None:
    """Mouse down on an element at a given position.

    Args:
        browser: The browser to use.
        x: The x coordinate of the element to click.
        y: The y coordinate of the element to click.
        button: The button to click on. Defaults to `"left"`.
    """
    _ = browser.mousedown(x, y, button)

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_mouseup has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Mouse up on an element at a given position.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

x

The x coordinate of the element to click.

TYPE: float | None DEFAULT: None

y

The y coordinate of the element to click.

TYPE: float | None DEFAULT: None

button

The button to click on. Defaults to "left".

TYPE: MouseButton DEFAULT: 'left'

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_mouseup(
    browser: SimpleBrowser,
    *,
    x: float | None = None,
    y: float | None = None,
    button: MouseButton = "left",
) -> None:
    """Mouse up on an element at a given position.

    Args:
        browser: The browser to use.
        x: The x coordinate of the element to click.
        y: The y coordinate of the element to click.
        button: The button to click on. Defaults to `"left"`.
    """
    _ = browser.mouseup(x, y, button)

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_move has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Move the mouse to a given position.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

x

The x coordinate of the element to click.

TYPE: float

y

The y coordinate of the element to click.

TYPE: float

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_mouse_move(
    browser: SimpleBrowser,
    x: float,
    y: float,
) -> None:
    """Move the mouse to a given position.

    Args:
        browser: The browser to use.
        x: The x coordinate of the element to click.
        y: The y coordinate of the element to click.
    """
    _ = browser.mouse_move(x, y, wait_for_load=True)

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_drag has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Drag the mouse.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

path

The path to drag the mouse to.

TYPE: list[tuple[float, float]]

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_drag(
    browser: SimpleBrowser,
    path: list[tuple[float, float]],
) -> None:
    """Drag the mouse.

    Args:
        browser: The browser to use.
        path: The path to drag the mouse to.
    """
    _ = browser.drag(path, wait_for_load=True)

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_scroll has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will 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: SimpleBrowser

direction

The direction to scroll.

TYPE: ScrollDirection

magnitude_px

The magnitude to scroll.

TYPE: int | None DEFAULT: None

magnitude_relative

The magnitude to scroll relative to the current viewport size.

TYPE: float | None DEFAULT: None

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_scroll(
    browser: SimpleBrowser,
    direction: ScrollDirection,
    *,
    magnitude_px: int | None = None,
    magnitude_relative: float | None = None,
) -> None:
    """Scroll the browser.

    Unless you know what you are doing, you should use the `magnitude_relative`
    argument.

    Args:
        browser: The browser to use.
        direction: The direction to scroll.
        magnitude_px: The magnitude to scroll.
        magnitude_relative: The magnitude to scroll relative to the current
            viewport size.
    """
    _ = browser.scroll(
        direction,
        magnitude_px,
        magnitude_relative,
        wait_for_load=True,
    )

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_precise has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Scroll the browser precisely.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

delta_x

The x coordinate of the scroll distance.

TYPE: float

delta_y

The y coordinate of the scroll distance.

TYPE: float

start_x

The x coordinate to start scrolling from.

TYPE: float | None DEFAULT: None

start_y

The y coordinate to start scrolling from.

TYPE: float | None DEFAULT: None

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_scroll_precise(
    browser: SimpleBrowser,
    delta_x: float,
    delta_y: float,
    *,
    start_x: float | None = None,
    start_y: float | None = None,
) -> None:
    """Scroll the browser precisely.

    Args:
        browser: The browser to use.
        delta_x: The x coordinate of the scroll distance.
        delta_y: The y coordinate of the scroll distance.
        start_x: The x coordinate to start scrolling from.
        start_y: The y coordinate to start scrolling from.
    """
    _ = browser.scroll_precise(
        delta_x,
        delta_y,
        start_x=start_x,
        start_y=start_y,
        wait_for_load=True,
    )

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_keypress has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Press keys into the page.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

keys

The keys to press.

TYPE: list[str]

duration

The duration to hold the key.

TYPE: float DEFAULT: 0

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_keypress(
    browser: SimpleBrowser,
    keys: list[str],
    *,
    duration: float = 0,
) -> None:
    """Press keys into the page.

    Args:
        browser: The browser to use.
        keys: The keys to press.
        duration: The duration to hold the key.
    """
    _ = browser.keypress(keys, duration, wait_for_load=True)

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_type has additional properties and methods that you can use (see the Action documentation for more information);
  • but it also means that operations like issubclass and isinstance will not work as expected.

Type text into the page.

PARAMETER DESCRIPTION
browser

The browser to use.

TYPE: SimpleBrowser

text

The text to type.

TYPE: str

Source code in conatus/actions/preloaded/browsing.py
@action(hide_if_computer_use_mode=True, force_update_on="browser")
def browser_type(
    browser: SimpleBrowser,
    text: str,
) -> None:
    """Type text into the page.

    Args:
        browser: The browser to use.
        text: The text to type.
    """
    _ = browser.type(text, wait_for_load=True)