概要
- genAIを使ったEnd-to-Endテストをローカル環境で実行する方法の調査
- 外側からの監視を優先し、ボトルネックを特定する手法の検討
調査
構成としては多分、ブラウザ操作 Library + それを上から wrap するライブラリ という構成のはず
Priwright / Cypress あたりがブラウザ操作
それを上からラップるすのは
Amazon Nova Act / Browser-Useとか?
Browser-Use 調査
https://github.com/browser-use/browser-use Pip でインストールしてそのまま実行したりもできる
priwright が必要
uvx playwright install chromium --with-deps --no-shell
サンプルコード
import asyncio
from dotenv import load_dotenv
load_dotenv()
from browser_use import Agent, ChatOpenAI
async def main():
agent = Agent(
task="Find the number of stars of the browser-use repo",
llm=ChatOpenAI(model="gpt-4.1-mini"),
)
await agent.run()
asyncio.run(main())
ChatOpenAI 以外も渡せるっぽい?
これはこれでいいけど、テストするなら typescript が良い
browser-use-typescript
https://github.com/Vadavision/browser-use-ts
# Clone the repository
git clone https://github.com/vadavision/browser-use-ts.git
# Navigate to the project directory
cd browser-use-ts
# Install dependencies
npm install
## install bedrock
npm i @langchain/community @langchain/core @aws-crypto/sha256-js @smithy/protocol-http @smithy/signature-v4 @smithy/eventstream-codec @smithy/util-utf8 @aws-sdk/types
npx tsx examples/search.ts
PJ取り込み方法
npm install https://github.com/{username}/{repo}
npm create vite@latest
npm install -D https://github.com/Vadavision/browser-use-ts
npm install -D @langchain/community @langchain/core @aws-crypto/sha256-js @smithy/protocol-http @smithy/signature-v4 @smithy/eventstream-codec @smithy/util-utf8 @aws-sdk/types
npm install -D vitest
edit pagkage.json
{
"name": "test",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"test": "vitest"
},
"devDependencies": {
"@aws-crypto/sha256-js": "^5.2.0",
"@aws-sdk/types": "^3.862.0",
"@langchain/community": "^0.3.55",
"@langchain/core": "^0.3.75",
"@smithy/eventstream-codec": "^2.2.0",
"@smithy/protocol-http": "^3.3.0",
"@smithy/signature-v4": "^2.3.0",
"@smithy/util-utf8": "^2.3.0",
"browser-use-ts": "github:Vadavision/browser-use-ts",
"typescript": "~5.8.3",
"vite": "^7.1.2",
"vitest": "^3.2.4"
}
}
これを使うのしんどい
Amazon Nova Act 検討