SuperAPI AI Directory

browser-automation

General & other

View repository

Updated 10-16 08:52

About this skill

Browser Automation Skill

Let OpenClaw control the browser for automation operations!

Features

  • Reuse pages: By default, reuses existing pages and does not open a new window every time
  • Persistent Cookies: Uses a separate user data directory, so login state is persistently saved
  • Complete operations: Supports clicking, form filling, screenshots, executing JS, etc.

Functions

  • Navigate to URL
  • Click element
  • Fill out form
  • Screenshot
  • Get page content
  • Wait for element
  • Execute JavaScript

When to use

When the user says:

  • "Open xxx.com"
  • "Click the login button"
  • "Help me fill out this form"
  • "Take a screenshot"
  • "What content is on the webpage"

Available functions

How to call: cd C:/Users/admin/.openclaw/skills/browser-automation && node -e "const h=require('./index.js'); h.handleXXX({...}).then(console.log)"

Page operations

  • handleNavigate({url}) - Navigate to URL (reuse existing page)
  • handleNewPage({url}) - Open a new page
  • handleScreenshot({selector?, fullPage?}) - Screenshot
  • handleGetContent({selector?}) - Get page content
  • handleClose() - Close the current page

Interaction operations

  • handleClick({selector}) - Click element
  • handleFill({selector, value, clear?}) - Fill out form
  • handleType({selector, text, delay?}) - Simulate typing
  • handleSelect({selector, value}) - Dropdown select
  • handleCheck({selector, checked?}) - Check/uncheck

Wait and get

  • handleWait({selector, timeout?}) - Wait for element to appear
  • handleWaitForNavigation({timeout?}) - Wait for page navigation
  • handleGetText({selector}) - Get element text
  • handleGetValue({selector}) - Get form value
  • handleGetAttribute({selector, attribute}) - Get attribute

Advanced operations

  • handleEvaluate({script}) - Execute JavaScript
  • handleUpload({selector, filePath}) - Upload file
  • handlePress({key}) - Press key
  • handleHover({selector}) - Mouse hover
  • handleScroll({direction, amount?}) - Scroll page

Status

  • handleStatus() - Get current browser status
  • handleCloseBrowser() - Close browser (will restart next time)

Selector syntax

Supports CSS selectors and text selectors:

  • CSS: #login-btn, .submit-button, input[name="email"]
  • Text: text=登录, text=提交
  • Combination: button:has-text("提交")

Example

用户: 打开 github.com
Agent: [调用 handleNavigate({url: 'https://github.com'})] 已打开 GitHub...

用户: 点击登录
Agent: [调用 handleClick({selector: 'text=Sign in'})] 已点击登录...

用户: 填写邮箱 test@example.com
Agent: [调用 handleFill({selector: '#login_field', value: 'test@example.com'})] 已填写邮箱...

用户: 截个图看看
Agent: [调用 handleScreenshot()] [返回截图]