from notte_sdk import NotteClient, actions
notte = NotteClient()
with notte.Session() as session:
# Observe the state of a webpage
_ = session.execute(
actions.Goto(url="https://google.com/travel/flights")
)
obs = session.observe()
print("Page Title:", obs.metadata.title)
print(
"Available Actions:\n",
obs.space.description,
)
# # Example Output:
# # Flight Search
# * I1: Enter departure location
# ...{
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"metadata": {
"title": "<string>",
"url": "<string>",
"viewport": {
"scroll_x": 123,
"scroll_y": 123,
"viewport_width": 123,
"viewport_height": 123,
"total_width": 123,
"total_height": 123
},
"tabs": [
{
"tab_id": 123,
"title": "<string>",
"url": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z"
},
"screenshot": {
"raw": "<string>",
"bboxes": [
{
"x": 123,
"y": 123,
"width": 123,
"height": 123,
"scroll_x": 123,
"scroll_y": 123,
"viewport_width": 123,
"viewport_height": 123,
"iframe_offset_x": 0,
"iframe_offset_y": 0,
"notte_id": "<string>"
}
],
"last_action_id": "<string>"
},
"space": {
"description": "<string>",
"interaction_actions": [
{
"type": "click",
"category": "Interaction Actions",
"description": "Click on an element of the current page",
"id": "",
"selector": "<string>",
"press_enter": true,
"text_label": "<string>",
"timeout": 5000
}
],
"actions": [
{
"value": {},
"type": "form_fill",
"category": "Special Browser Actions",
"description": "Fill a form with multiple values. Important: If you detect a form requesting personal information, try to use this action at first, and otherwise use the regular fill action. CRITICAL: If this action fails once, use the regular form fill instead."
}
],
"browser_actions": [
{
"value": {},
"type": "form_fill",
"category": "Special Browser Actions",
"description": "Fill a form with multiple values. Important: If you detect a form requesting personal information, try to use this action at first, and otherwise use the regular fill action. CRITICAL: If this action fails once, use the regular form fill instead."
}
],
"markdown": "<string>",
"category": "homepage"
}
}from notte_sdk import NotteClient, actions
notte = NotteClient()
with notte.Session() as session:
# Observe the state of a webpage
_ = session.execute(
actions.Goto(url="https://google.com/travel/flights")
)
obs = session.observe()
print("Page Title:", obs.metadata.title)
print(
"Available Actions:\n",
obs.space.description,
)
# # Example Output:
# # Flight Search
# * I1: Enter departure location
# ...{
"started_at": "2023-11-07T05:31:56Z",
"ended_at": "2023-11-07T05:31:56Z",
"metadata": {
"title": "<string>",
"url": "<string>",
"viewport": {
"scroll_x": 123,
"scroll_y": 123,
"viewport_width": 123,
"viewport_height": 123,
"total_width": 123,
"total_height": 123
},
"tabs": [
{
"tab_id": 123,
"title": "<string>",
"url": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z"
},
"screenshot": {
"raw": "<string>",
"bboxes": [
{
"x": 123,
"y": 123,
"width": 123,
"height": 123,
"scroll_x": 123,
"scroll_y": 123,
"viewport_width": 123,
"viewport_height": 123,
"iframe_offset_x": 0,
"iframe_offset_y": 0,
"notte_id": "<string>"
}
],
"last_action_id": "<string>"
},
"space": {
"description": "<string>",
"interaction_actions": [
{
"type": "click",
"category": "Interaction Actions",
"description": "Click on an element of the current page",
"id": "",
"selector": "<string>",
"press_enter": true,
"text_label": "<string>",
"timeout": 5000
}
],
"actions": [
{
"value": {},
"type": "form_fill",
"category": "Special Browser Actions",
"description": "Fill a form with multiple values. Important: If you detect a form requesting personal information, try to use this action at first, and otherwise use the regular fill action. CRITICAL: If this action fails once, use the regular form fill instead."
}
],
"browser_actions": [
{
"value": {},
"type": "form_fill",
"category": "Special Browser Actions",
"description": "Fill a form with multiple values. Important: If you detect a form requesting personal information, try to use this action at first, and otherwise use the regular fill action. CRITICAL: If this action fails once, use the regular form fill instead."
}
],
"markdown": "<string>",
"category": "homepage"
}
}The access token received from the authorization server in the OAuth 2.0 flow.
The minimum number of actions to list before stopping. If not provided, the listing will continue until the maximum number of actions is reached.
The maximum number of actions to list after which the listing will stop. Used when min_nb_actions is not provided.
Additional instructions to use for the observation.
Whether to run with fast or deep perception
fast, deep Successful Response
Metadata of the current page, i.e url, page title, snapshot timestamp.
Show child attributes
Base64 encoded screenshot of the current page
Show child attributes
Available actions in the current state
Show child attributes
Was this page helpful?
Suggestions