docs: update instruction for bridge mode (#428)

* docs: update instruction for bridge mode

* fix: ai test
This commit is contained in:
yuyutaotao 2025-02-26 17:06:14 +08:00 committed by GitHub
parent 724a2c7230
commit d0a3d86e22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 8 deletions

View File

@ -53,9 +53,15 @@ Promise.resolve(
);
```
## Step 3. run
## Step 3. start the chrome extension
Launch your desktop Chrome. Start Midscene extension and switch to 'Bridge Mode' tab. Click "Allow connection".
Start the chrome extension and switch to 'Bridge Mode' tab. Click "Allow connection".
<p align="center">
<img src="/bridge_in_extension.jpg" alt="bridge in extension" width="400"/>
</p>
## Step 4. run the script
Run your scripts
@ -65,7 +71,7 @@ tsx demo-new-tab.ts
After executing the script, you should see the status of the Chrome extension switched to 'connected', and a new tab has been opened. Now this tab is controlled by your scripts.
:::info
:::tip
Whether the scripts are run before or after clicking 'Allow connection' in the browser is not significant.
:::
@ -81,7 +87,7 @@ Except [the normal parameters in the agent constructor](./api), `AgentOverChrome
* `closeNewTabsAfterDisconnect?: boolean`: If true, the newly created tab will be closed when the bridge is destroyed. Default is false.
## API
## Methods
Except [the normal agent interface](./api), `AgentOverChromeBridge` provides some other interfaces to control the desktop Chrome.

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View File

@ -53,9 +53,15 @@ Promise.resolve(
);
```
## 第三步:运行脚本
## 第三步:启动 Chrome 插件
启动你的桌面 Chrome。启动 Midscene 插件,并切换到 'Bridge Mode' 标签页。点击 "Allow connection"。
启动你的桌面 Chrome 和 Midscene 插件,并切换到 'Bridge Mode' 标签页。点击 "Allow connection"。
<p align="center">
<img src="/bridge_in_extension.jpg" alt="bridge in extension" width="400"/>
</p>
## 第四步:运行脚本
运行你的脚本
@ -81,7 +87,7 @@ const agent = new AgentOverChromeBridge();
* `closeNewTabsAfterDisconnect?: boolean`: 如果为 true当桥接断开时所有新创建的标签页都将被自动关闭。默认值为 false。
## API
## 方法
除了 [普通的 Agent 接口](./api)`AgentOverChromeBridge` 还提供了一些额外的接口来控制桌面 Chrome。

View File

@ -46,7 +46,7 @@ describe(
console.log('item list', items);
expect(items.length).toBeGreaterThanOrEqual(2);
await agent.aiAssert('The price of "Sauce Labs Onesie" is 7.99');
await agent.aiAssert('The price of "Sauce Labs Backpack" is 29.99');
});
it('extract the Github service status', async () => {