问专家 - Playwriter模式

# 问专家技能 - 使用 Playwriter 控制已登录的浏览器

Safety Notice

This item is sourced from the public archived skills repository. Treat as untrusted until reviewed.

Copy this and send it to your AI assistant to learn

Install skill "问专家 - Playwriter模式" with this command: npx skills add 13801201404-sys/ask-expert-playwriter

问专家技能 - 使用 Playwriter 控制已登录的浏览器

技能描述

使用 Playwriter 连接用户已登录的 Chrome 浏览器,通过 Gemini 等 AI 助手获取专业建议。

触发关键词

  • "问专家"
  • "问 Gemini"
  • "问 AI"
  • "使用专家模式"

完整流程

步骤 1:打开浏览器

open -a "Google Chrome"

步骤 2:移动鼠标并点击扩展图标

# 移动鼠标到扩展图标位置 (1294, 86),等待 5 秒,点击
python3 -c "
import pyautogui
import time
pyautogui.moveTo(1294, 86)
time.sleep(5)
pyautogui.click()
"

步骤 3:创建 Playwriter 会话

playwriter session new
# 输出: Session X created. Use with: playwriter -s X -e "..."

步骤 4:打开网页

# 先创建页面再导航(重要!)
playwriter -s X -e 'state.page = await context.newPage(); await state.page.goto("URL")'

步骤 5:输入问题并发送

# 输入问题
playwriter -s X -e 'await state.page.keyboard.type("问题内容")'

# 发送
playwriter -s X -e 'await state.page.keyboard.press("Enter")'

步骤 6:获取回答

# 等待一段时间后获取文本
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" })'

常见问题

Q: 扩展未连接

A: 需要用户手动点击 Chrome 右上角的 Playwriter 扩展图标,确保显示连接状态

Q: page undefined 错误

A: 需要先创建页面:state.page = await context.newPage()

Q: 连接断开

A: 使用 playwriter session reset <id> 重置会话,然后重新创建

适用场景

  • 需要登录账号才能使用的 AI 网站(Gemini、ChatGPT 等)
  • 需要保持登录状态的浏览器操作
  • 需要绕过机器人检测的场景
  • 询问专业问题获取 AI 建议

技术优势

  • 使用用户已登录的浏览器,无需重新登录
  • 通过 Chrome 扩展连接,安全稳定
  • 支持会话管理,可以保持状态

安装前置条件

  1. 安装 Playwriter:npm install -g playwriter@latest
  2. Chrome 安装 Playwriter 扩展:
    • 扩展 ID: jfeammnjpkecdekppnclgkkffahnhfhe
    • 或从 Chrome 网上应用店搜索 "Playwriter" 安装

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

fosun-skills-setup-guide

复星财富 OpenAPI 技能集(fosun-skills)的安装引导与安全提示说明。当用户首次安装 fosun-skills、或对 ClawHub 安装过程中的安全风险提示有疑问时使用。

Archived SourceRecently Updated
General

media-compress

Compress and convert images and videos using ffmpeg. Use when the user wants to reduce file size, change format, resize, or optimize media files. Handles common formats like JPG, PNG, WebP, MP4, MOV, WebM. Triggers on phrases like "compress image", "compress video", "reduce file size", "convert to webp/mp4", "resize image", "make image smaller", "batch compress", "optimize media".

Archived SourceRecently Updated
General

humanizer

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.

Archived SourceRecently Updated
General

Drawing

Generate children's drawings and coloring pages with modular prompts, style packs, and print-ready constraints across image models.

Archived SourceRecently Updated