Summary
If I set a custom viewport, I expect it to be taken into account. It was partially fixed in #952, but not fully, frame messages still contain wrong metadata and image.
Steps to reproduce
import { execSync } from "child_process";
execSync("agent-browser set viewport 1000 1000");
execSync("agent-browser open https://example.com");
await new Promise((r) => setTimeout(r, 2000));
const ws = new WebSocket(
`ws://localhost:${process.env.AGENT_BROWSER_STREAM_PORT}`,
);
ws.onmessage = (e) => {
const { data, ...rest } = JSON.parse(e.data);
console.log("ws message", { ...rest });
};
await new Promise((r) => setTimeout(r, 5_000));
execSync("agent-browser reload");
await new Promise((r) => setTimeout(r, 5_000));
execSync("agent-browser close");
- Save this code snippet as
repro.mjs
- Install the latest agent-browser (I've tested with 0.22.3)
- Run
AGENT_BROWSER_STREAM_PORT=9224 node repro.mjs
Actual output
ws message {
connected: true,
screencasting: false,
type: 'status',
viewportHeight: 1000,
viewportWidth: 1000
}
ws message {
connected: true,
screencasting: true,
type: 'status',
viewportHeight: 1000,
viewportWidth: 1000
}
ws message {
metadata: {
deviceHeight: 577,
deviceWidth: 1280,
offsetTop: 0,
pageScaleFactor: 1,
scrollOffsetX: 0,
scrollOffsetY: 0,
timestamp: 0
},
type: 'frame'
}
ws message {
metadata: {
deviceHeight: 577,
deviceWidth: 1280,
offsetTop: 0,
pageScaleFactor: 1,
scrollOffsetX: 0,
scrollOffsetY: 0,
timestamp: 0
},
type: 'frame'
}
ws message {
connected: false,
screencasting: true,
type: 'status',
viewportHeight: 1000,
viewportWidth: 1000
}
Expected output
deviceWidth, deviceHeight and the image (data) respect the custom viewport.
Summary
If I set a custom viewport, I expect it to be taken into account. It was partially fixed in #952, but not fully,
framemessages still contain wrong metadata and image.Steps to reproduce
repro.mjsAGENT_BROWSER_STREAM_PORT=9224 node repro.mjsActual output
Expected output
deviceWidth,deviceHeightand the image (data) respect the custom viewport.