Loading...
Loading...
通过inference.sh为AI Agent实现浏览器自动化。 浏览网页,使用@e引用与元素交互,截取屏幕截图。 功能:网页爬取、表单填写、点击操作、文本输入、JavaScript执行。 适用场景:网页自动化、数据提取、测试、Agent网页浏览、研究。 触发词:浏览器、网页自动化、爬取、导航、点击、填写表单、截图、网页浏览、Playwright、无头浏览器、Web Agent、上网冲浪
npx skill4agent add inference-sh/skills agentic-browsercurl -fsSL https://cli.inference.sh | sh && infsh login
# Open a page and get interactive elements
infsh app run agentic-browser --function open --input '{"url": "https://example.com"}' --session new@e# Start session
RESULT=$(infsh app run agentic-browser --function open --session new --input '{
"url": "https://example.com/login"
}')
SESSION_ID=$(echo $RESULT | jq -r '.session_id')
# Elements returned like: @e1 [input] "Email", @e2 [input] "Password", @e3 [button] "Sign In"
# Fill form
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "fill", "ref": "@e1", "text": "user@example.com"
}'
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "fill", "ref": "@e2", "text": "password123"
}'
# Click submit
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "click", "ref": "@e3"
}'
# Close when done
infsh app run agentic-browser --function close --session $SESSION_ID --input '{}'@einfsh app run agentic-browser --function open --session new --input '{
"url": "https://example.com",
"width": 1280,
"height": 720,
"user_agent": "Mozilla/5.0..."
}'urltitleelements@escreenshotinfsh app run agentic-browser --function snapshot --session $SESSION_ID --input '{}'@e| 操作 | 描述 | 必填字段 |
|---|---|---|
| 点击元素 | |
| 清空并输入文本 | |
| 输入文本(不清空原有内容) | |
| 按下按键 | |
| 选择下拉选项 | |
| 悬停在元素上 | |
| 滚动页面 | |
| 返回历史页面 | - |
| 等待指定毫秒数 | |
# Click
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "click", "ref": "@e5"
}'
# Fill input
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "fill", "ref": "@e1", "text": "hello@example.com"
}'
# Press Enter
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "press", "text": "Enter"
}'
# Scroll down
infsh app run agentic-browser --function interact --session $SESSION_ID --input '{
"action": "scroll", "direction": "down"
}'infsh app run agentic-browser --function screenshot --session $SESSION_ID --input '{
"full_page": true
}'infsh app run agentic-browser --function execute --session $SESSION_ID --input '{
"code": "document.title"
}'infsh app run agentic-browser --function close --session $SESSION_ID --input '{}'@e@e1 [a] "Home" href="/"
@e2 [input type="text"] placeholder="Search"
@e3 [button] "Submit"
@e4 [select] "Choose option"SESSION=$(infsh app run agentic-browser --function open --session new --input '{
"url": "https://example.com/contact"
}' | jq -r '.session_id')
# Get elements: @e1 [input] "Name", @e2 [input] "Email", @e3 [textarea] "Message", @e4 [button] "Send"
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "fill", "ref": "@e1", "text": "John Doe"}'
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "fill", "ref": "@e2", "text": "john@example.com"}'
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "fill", "ref": "@e3", "text": "Hello!"}'
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "click", "ref": "@e4"}'
# Check result
infsh app run agentic-browser --function snapshot --session $SESSION --input '{}'
infsh app run agentic-browser --function close --session $SESSION --input '{}'SESSION=$(infsh app run agentic-browser --function open --session new --input '{
"url": "https://google.com"
}' | jq -r '.session_id')
# Fill search box and submit
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "fill", "ref": "@e1", "text": "weather today"}'
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "press", "text": "Enter"}'
infsh app run agentic-browser --function interact --session $SESSION --input '{"action": "wait", "wait_ms": 2000}'
# Get results page
infsh app run agentic-browser --function snapshot --session $SESSION --input '{}'
infsh app run agentic-browser --function close --session $SESSION --input '{}'infsh app run agentic-browser --function execute --session $SESSION --input '{
"code": "Array.from(document.querySelectorAll(\"h2\")).map(h => h.textContent)"
}'--session newsession_id# Web search (for research + browse)
npx skills add inference-sh/skills@web-search
# LLM models (analyze extracted content)
npx skills add inference-sh/skills@llm-models