
剧作家MCP检验
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
Playwright MCP テスト
このプロジェクトは、Model Context Protocol (MCP) を使用してPlaywrightによるブラウザ自動操作をAIモデルから制御するテスト環境です。Google GeminiまたはOpenAIのモデルを使用して、Playwrightツールを通じてWebブラウザを操作できます。
機能
- PlaywrightによるWebブラウザの自動操作
- Google GeminiまたはOpenAIのLLMモデルを選択可能
- 操作中のスクリーンショットの自動保存
- LangChainとLangGraphによるツール呼び出しフロー制御
必要条件
- Python 3.8以上
- Playwrightがインストールされたブラウザ
- Google GeminiまたはOpenAIのAPIキー
インストール
-
リポジトリをクローンするか、ファイルをダウンロードします。
-
依存パッケージをインストールします:
pip install -r requirements.txt
- 環境変数を設定します:
# Google Geminiを使用する場合
export GOOGLE_APIKEY=your_google_api_key
# OpenAIを使用する場合
export OPENAI_API_KEY=your_openai_api_key
Windowsの場合は以下のコマンドを使用します:
# Google Geminiを使用する場合
set GOOGLE_APIKEY=your_google_api_key
# OpenAIを使用する場合
set OPENAI_API_KEY=your_openai_api_key
設定
mcp_config.json
ファイルで、使用するモデルとMCPサーバーの設定を行います:
{
"modelConfig": {
"provider": "google", // "google" または "openai"
"models": {
"google": {
"model": "gemini-2.0-flash", // または別のGeminiモデル
"temperature": 0.1
},
"openai": {
"model": "gpt-4.1-mini", // または別のOpenAIモデル
"temperature": 0.1
}
}
},
"mcpServers": [
{
"url": "http://localhost:8000", // PlaywrightのMCPサーバーURL
"tools": ["browser_*"] // 使用するツールパターン
}
]
}
使用方法
- スクリプトを実行します:
python playwright_mcp_langchain_tools.py
-
プロンプトが表示されたら、実行したいブラウザ操作を日本語で入力します。例:
- "Googleのトップページにアクセスして検索してください"
- "ウィキペディアで人工知能について調べてください"
-
AIがPlaywrightを使ってブラウザを操作し、スクリーンショットを保存します。
-
終了するには、
exit
またはquit
と入力します。
スクリーンショット
スクリーンショットは自動的にscreenshots
ディレクトリに保存されます。ファイル名は日時とカウンターに基づいて生成されます。
注意事項
- ブラウザ操作は実際のブラウザを使用するため、操作中はブラウザウィンドウが開きます。
- ネットワークエラーが発生した場合は、コマンドを再実行してみてください。
- 複雑な操作や長時間の操作の場合は、適切なタイムアウト設定が必要な場合があります。
- GPT-4.1-nanoの場合、正しくスクリーンショットを取得できない場合があります。
- 操作が長い場合、LLMの戻りが遅くなります。今後入力トークン数の圧縮などを行い、対策を行う予定です。
トラブルシューティング
- APIキーが正しく設定されていることを確認してください
- MCPサーバーが正しく起動していることを確認してください
- Playwrightが正しくインストールされていることを確認してください
相关推荐
😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack
Reviews

user_WnnaT0kj
As a dedicated user of MCP applications, I'm thrilled with the playwright-mcp-test by s-ono-123456. It offers seamless user interaction and intuitive navigation, making automated testing efficient and straightforward. The start URL setup was clean, and the welcome information ensured a smooth onboarding experience. Highly recommend for anyone in need of reliable test automation solutions!

user_zF7SKuU1
I've been using the Playwright-MCP-Test by s-ono-123456 and it has completely surpassed my expectations. The ease of navigation and the efficiency in testing has made my workflow much smoother. Highly recommend this to anyone looking for a reliable testing tool!

user_kOLjt109
I recently used the Playwright-MCP-Test authored by s-ono-123456 and it exceeded my expectations! The user-friendly interface and seamless integration into my existing system made testing smooth and efficient. The comprehensive welcome information guided me through the initial setup effortlessly. Highly recommend this for anyone looking to enhance their testing capabilities!

user_4kdDLGHw
I have been using playwright-mcp-test by s-ono-123456 and it has been an absolute game-changer for my workflow. The seamless integration and ease of use make it a must-have for any serious developer. The product is well-supported and constantly updated. Highly recommend!

user_4NYFOb2t
I've been using the Playwright-MCP-Test by s-ono-123456 and it has significantly streamlined my testing process. It's incredibly user-friendly and integrates seamlessly with my workflow. The starting URL and welcome information are clear and helpful, making the setup a breeze. Highly recommended for anyone in need of a robust testing tool!

user_9xdfHf8i
I have been using the Playwright MCP Test from s-ono-123456 and it has significantly streamlined my web application testing process. The seamless integration and user-friendly interface make automated testing incredibly efficient. Highly recommend it to fellow developers!

user_YPRwjO28
I've been using playwright-mcp-test by s-ono-123456, and it’s truly impressive! This tool simplifies automated testing with ease, enhancing productivity considerably. The clean interface and efficient functionality make it a must-have for any development workflow. Highly recommend it!

user_kekfuooh
I've been using "playwright-mcp-test" by s-ono-123456 and it's simply outstanding. The seamless integration and user-friendly interface provide an excellent experience. Whether you are new to MCP applications or a seasoned user, this product will exceed your expectations. Highly recommended!

user_GSQFqhpc
As a devoted user of the mcp application, I am thrilled with the playwright-mcp-test created by s-ono-123456. This tool has significantly streamlined my testing process. It is intuitive, efficient, and provides reliable results. Highly recommended for anyone seeking to enhance their test automation.

user_YBoR9ETR
Playwright-mcp-test is an exceptional tool for automated testing. Created by s-ono-123456, it offers robust performance and efficient test execution. This tool is easy to use and well-documented, making it perfect for both beginners and experienced developers. Highly recommend!

user_WHVKNpbn
I've been using playwright-mcp-test by s-ono-123456 and it's truly impressive. The application performs seamlessly, making test automation smooth and efficient. The setup was straightforward, and the welcome information guided me perfectly. Highly recommended for anyone looking to streamline their testing processes!