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 pagehandleScreenshot({selector?, fullPage?})- ScreenshothandleGetContent({selector?})- Get page contenthandleClose()- Close the current page
Interaction operations
handleClick({selector})- Click elementhandleFill({selector, value, clear?})- Fill out formhandleType({selector, text, delay?})- Simulate typinghandleSelect({selector, value})- Dropdown selecthandleCheck({selector, checked?})- Check/uncheck
Wait and get
handleWait({selector, timeout?})- Wait for element to appearhandleWaitForNavigation({timeout?})- Wait for page navigationhandleGetText({selector})- Get element texthandleGetValue({selector})- Get form valuehandleGetAttribute({selector, attribute})- Get attribute
Advanced operations
handleEvaluate({script})- Execute JavaScripthandleUpload({selector, filePath})- Upload filehandlePress({key})- Press keyhandleHover({selector})- Mouse hoverhandleScroll({direction, amount?})- Scroll page
Status
handleStatus()- Get current browser statushandleCloseBrowser()- 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()] [返回截图]