使用AI大模型实现自然语言控制浏览器自动搜索
环境搭建
- 安装Playwright
pip install playwright
playwright install # 自动安装浏览器驱动
用户客户端配置
Vscode Cline
安装Cline插件
配置启动参数
点击installed,打开配置文件
{
"mcpServers": {
"playwright": {
"autoApprove": [
"start_codegen_session",
"end_codegen_session",
"get_codegen_session",
"clear_codegen_session",
"playwright_navigate",
"playwright_screenshot",
"playwright_click",
"playwright_iframe_click",
"playwright_fill",
"playwright_select",
"playwright_hover",
"playwright_evaluate",
"playwright_console_logs",
"playwright_close",
"playwright_get",
"playwright_post",
"playwright_put",
"playwright_patch",
"playwright_delete",
"playwright_expect_response",
"playwright_assert_response",
"playwright_custom_user_agent",
"playwright_get_visible_text",
"playwright_get_visible_html",
"playwright_go_back",
"playwright_go_forward",
"playwright_drag",
"playwright_press_key",
"playwright_save_as_pdf"
],
"disabled": true,
"timeout": 60,
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@executeautomation/playwright-mcp-server"
],
"transportType": "stdio"
}
}
}
- 配置大模型API

效果展示
- 执行自动化任务