Install
openclaw skills install ask-expert-playwriter使用 Playwriter 控制已登录的 Chrome 浏览器,通过 AI 助手获取专业建议,适合需登录账号的 AI 网站操作。
openclaw skills install ask-expert-playwriter使用 Playwriter 连接用户已登录的 Chrome 浏览器,通过 Gemini 等 AI 助手获取专业建议。
open -a "Google Chrome"
# 移动鼠标到扩展图标位置 (1294, 86),等待 5 秒,点击
python3 -c "
import pyautogui
import time
pyautogui.moveTo(1294, 86)
time.sleep(5)
pyautogui.click()
"
playwriter session new
# 输出: Session X created. Use with: playwriter -s X -e "..."
# 先创建页面再导航(重要!)
playwriter -s X -e 'state.page = await context.newPage(); await state.page.goto("URL")'
# 输入问题
playwriter -s X -e 'await state.page.keyboard.type("问题内容")'
# 发送
playwriter -s X -e 'await state.page.keyboard.press("Enter")'
# 等待一段时间后获取文本
sleep 15
playwriter -s X -e 'const text = await state.page.locator("message-content").last().textContent(); console.log(text)'
# 或截图
playwriter -s X -e 'await state.page.screenshot({ path: "path/to/screenshot.png" })'
A: 需要用户手动点击 Chrome 右上角的 Playwriter 扩展图标,确保显示连接状态
A: 需要先创建页面:state.page = await context.newPage()
A: 使用 playwriter session reset <id> 重置会话,然后重新创建
npm install -g playwriter@latestjfeammnjpkecdekppnclgkkffahnhfhe