diff --git a/examples/hello-world/x-follow-workflow.json b/examples/hello-world/x-follow-workflow.json new file mode 100644 index 00000000..6420a66a --- /dev/null +++ b/examples/hello-world/x-follow-workflow.json @@ -0,0 +1,115 @@ +{ + "variables": { + "url": { + "type": "string", + "label": "X.com URL", + "default": "https://x.com" + }, + "scroll_times": { + "type": "number", + "label": "Number of scrolls", + "default": 5 + }, + "profile_link_selector": { + "type": "string", + "label": "Profile Link Selector", + "default": "role:Link|name:/@/" + }, + "follow_button_selector": { + "type": "string", + "label": "Follow Button Selector", + "default": "role:Button|name:Follow" + }, + "scrollable_selector": { + "type": "string", + "label": "Scrollable Feed Selector", + "default": "role:Feed" + } + }, + "inputs": { + "url": "https://x.com", + "scroll_times": 5, + "profile_link_selector": "role:Link|name:/@/", + "follow_button_selector": "role:Button|name:Follow", + "scrollable_selector": "role:Feed" + }, + "selectors": { + "browser_window": "role:Document" + }, + "steps": [ + { + "tool_name": "navigate_browser", + "arguments": { + "url": "{{url}}" + }, + "outputs": { + "pid": "browser_pid" + } + }, + { + "tool_name": "wait_for_element", + "arguments": { + "selector": "{{selectors.browser_window}}", + "condition": "exists", + "timeout_ms": 8000 + } + }, + { + "group_name": "Scroll Feed", + "repeat": "{{scroll_times}}", + "steps": [ + { + "tool_name": "scroll_element", + "arguments": { + "selector": "{{scrollable_selector}}", + "direction": "down", + "amount": 800 + } + } + ] + }, + { + "tool_name": "extract_elements", + "arguments": { + "selector": "{{profile_link_selector}}", + "attribute": "url", + "max_items": 10 + }, + "outputs": { + "items": "profile_urls" + } + }, + { + "group_name": "Follow Users Loop", + "repeat": "{{profile_urls.length}}", + "steps": [ + { + "tool_name": "navigate_browser", + "arguments": { + "url": "{{profile_urls.[loop_index]}}" + } + }, + { + "tool_name": "wait_for_element", + "arguments": { + "selector": "{{follow_button_selector}}", + "condition": "exists", + "timeout_ms": 8000 + } + }, + { + "tool_name": "click_element", + "arguments": { + "selector": "{{follow_button_selector}}" + } + } + ] + }, + { + "tool_name": "wait", + "arguments": { + "duration_ms": 2000 + } + } + ] +}