使用 qwen 配置为:
OPENAI_API_KEY sk-xxxxxxxxxxx
OPENAI_BASE_URL https://dashscope.aliyuncs.com/compatible-mode/v1
MIDSCENE_MODEL_NAME qwen-vl-max-lates
运行 plawright-demo e2e 文件夹中的 “todo-mvc-zh.spec.ts” 文件,即:
import { expect } from "@playwright/test";
import { test } from "./fixture";
test.beforeEach(async ({ page }) => {
await page.goto("https://todomvc.com/examples/react/dist/");
});
test("ai todo - Chinese Prompt", async ({ ai, aiQuery, aiAssert }) => {
await ai("在任务框 input 输入 今天学习 JS,按回车键");
await ai("在任务框 input 输入 明天学习 Rust,按回车键");
await ai("在任务框 input 输入后天学习 AI,按回车键");
await ai("将鼠标移动到任务列表中的第二项,点击第二项任务右边的删除按钮");
await ai("点击第二条任务左边的勾选按钮");
await ai("点击任务列表下面的 completed 状态按钮");
const list = await aiQuery("string[], 完整的任务列表");
expect(list.length).toEqual(1);
await aiAssert('页面下方有一个区域显示有 "1 item left"');
});
-------------------------- 运行 指令为 : playwright test ./e2e/todo-mvc-zh.spec.ts --config=playwright.config.ts
报错信息如下:
{
"status": "failed",
"type": "Planning",
"locate": null,
"param": {
"userPrompt": "在任务框 input 输入 今天学习 JS,按回车键"
},
"timing": {
"start": 1734587525761,
"end": 1734587528641,
"cost": 2880
},
"recorder": [
{
"type": "screenshot",
"ts": 1734587525761,
"screenshot": "data:image...",
"timing": "before planning"
}
],
"pageContext": {
"content": [
{
"content": "todos",
"rect": {
"left": 542,
"top": 21,
"width": 196,
"height": 89,
"zoom": 1
},
"center": [
640,
65
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "770c90dee52b90bf",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": "
"
},
"indexId": 0
},
{
"content": "What needs to be done?",
"rect": {
"left": 365,
"top": 130,
"width": 550,
"height": 65,
"zoom": 1
},
"center": [
640,
162
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "[_midscene_retrieve_task_id='fbc2d0029b7a9037']",
"id": "fbc2d0029b7a9037",
"attributes": {
"class": ".new-todo",
"id": "todo-input",
"type": "text",
"data-testid": "text-input",
"placeholder": "What needs to be done?",
"style": "caret-color: transparent !important;",
"htmlTagName": "",
"nodeType": "FORM_ITEM Node"
},
"indexId": 1
},
{
"content": "New Todo Input",
"rect": {
"left": 914,
"top": 130,
"width": 97,
"height": 16,
"zoom": 1
},
"center": [
962,
138
],
"page": {
"underlyingPage": {
"_type": "Page",
"_guid": "page@461cab55131ed2cd61d03db1165eb8ba"
},
"pageType": "playwright",
"viewportSize": {
"width": 1280,
"height": 720,
"dpr": 1
}
},
"locator": "",
"id": "a894cd599156c8b0",
"attributes": {
"nodeType": "TEXT Node",
"htmlTagName": "
试了一下,感觉这个模型挺稳的才对。npm 依赖更新到最新版再看看?
更新版本试一下哈,这些场景应该都是兼容的。有问题再留言。