INNER CODE UNIT · JavaScript

sendMouseEvent

test-zeus-ai/testzeus-hercules · frontend/interactive/app.js:161

function sendMouseEvent(type, event) {
  const { deviceWidth, deviceHeight } = currentMetadata;
  const imgRect = imgElement.getBoundingClientRect();
  const imgWidth = imgRect.width;
  const imgHeight = imgRect.height;

  // Translate local image coordinates to browser coordinates
  const browserX = (event.offsetX / imgWidth) * deviceWidth;
  const browserY = (event.offsetY / imgHeight) * deviceHeight;

  const mouseParams = {
    id: 100,
    sessionId: sessionId,
    method: "Input.dispatchMouseEvent",
    params: {
      type: type,
      x: browserX,
      y: browserY,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…