Starter packs 📦📦📦¶
These are curated collections of Actions
that you can use to build Tasks. You can pass
them in the Task constructor like any other
Action:
from conatus import Browser, action
# Let's define a simple action
@action
def print_page_title(browser: Browser) -> None:
print(browser.page.title)
# Now let's import a starter pack
from conatus import browsing_actions, Task
task = Task(
description="Go to Google and print the page title",
name="get_google_title",
# You can pass both a starter pack and a single action
actions=[browsing_actions, print_page_title],
)
# And now we check that we have more than, say, 4 actions
assert len(task.actions) > 4
Browsing starter packs¶
browsing_actions
module-attribute
¶
browsing_actions = ActionStarterPack(
browser_start,
browser_goto,
browser_close,
browser_get_page_title,
browser_do_nothing,
browser_click,
browser_drag,
browser_keypress,
browser_mouse_move,
browser_mousedown,
browser_mouseup,
browser_scroll,
browser_scroll_precise,
browser_type,
browser_cursor_position,
)
A starter pack of actions for browsing.
Here, the browser is what's called "headless", meaning that it is not
visible. You should use visible_browsing_actions
if you want to
see a visible browser while the task is running.
This starter pack includes the following actions:
visible_browsing_actions
module-attribute
¶
visible_browsing_actions = (
browsing_actions - browser_start + browser_start_visible
)
A starter pack of actions for browsing, but with the browser visible.
See browsing_actions for
more information.