{"record":{"id":"f916439a1e275b9c","repo":"jackwener/OpenCLI","slug":"browser-hover-is-not-supported-by-this-browser-bac","errorCode":null,"errorMessage":"browser hover is not supported by this browser backend","messagePattern":"browser hover is not supported by this browser backend","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli.ts","lineNumber":2107,"sourceCode":"      if (isAutocomplete) await page.wait(0.4);\n      console.log(JSON.stringify({\n        typed: true,\n        text: resolved.value,\n        target: resolved.target,\n        matches_n,\n        match_level,\n        autocomplete: !!isAutocomplete,\n      }, null, 2));\n    }));\n\n  addBrowserTabOption(\n    addSemanticLocatorOptions(browser.command('hover'))\n      .argument('[target]', 'Numeric ref (from browser state / find), CSS selector, or omit when using --role/--name/etc.')\n      .option('--nth <n>', 'When <target> is a multi-match CSS selector, pick the nth match (0-based)')\n      .description('Move the mouse over an element — JSON envelope {hovered, target, matches_n}'),\n  )\n    .action(browserAction(async (page, target, opts) => {\n      if (typeof page.hover !== 'function') throw new Error('browser hover is not supported by this browser backend');\n      const resolvedTarget = await resolveWriteTargetOrPrint(page, target, opts ?? {});\n      if (!resolvedTarget) return;\n      const parsed = nthToResolveOpts(opts?.nth);\n      if ('error' in parsed) {\n        console.log(JSON.stringify({ error: { code: 'usage_error', message: parsed.error } }, null, 2));\n        process.exitCode = EXIT_CODES.USAGE_ERROR;\n        return;\n      }\n      const { matches_n, match_level } = await page.hover(resolvedTarget, parsed.opts);\n      console.log(JSON.stringify({ hovered: true, target: resolvedTarget, matches_n, match_level }, null, 2));\n    }));\n\n  addBrowserTabOption(\n    addSemanticLocatorOptions(browser.command('focus'))\n      .argument('[target]', 'Numeric ref (from browser state / find), CSS selector, or omit when using --role/--name/etc.')\n      .option('--nth <n>', 'When <target> is a multi-match CSS selector, pick the nth match (0-based)')\n      .description('Focus an element — JSON envelope {focused, target, matches_n}'),\n  )","sourceCodeStart":2089,"sourceCodeEnd":2125,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/cli.ts#L2089-L2125","documentation":"The `browser hover` command checks that the active page backend implements a `hover` method before proceeding. Backends that only implement a minimal page interface (e.g. raw CDP or DOM-less drivers) do not support hovering, so the command fails fast with this capability error instead of an undefined-function crash.","triggerScenarios":"Running `browser hover [target]` while connected to a browser backend whose page object lacks `page.hover` (feature-detection via `typeof page.hover !== 'function'`).","commonSituations":"Using a non-Playwright/Puppeteer backend, a headless custom driver, or an older/limited backend adapter; switching browser backend config so hover is unavailable in the new environment.","solutions":["Use a browser backend that supports mouse interaction (Playwright/Puppeteer-based).","Emulate hover another way, e.g. `browser eval` dispatching mouseover/mouseenter events.","Check the backend configuration (driver/browser flag) and switch to a full-featured one."],"exampleFix":"// before\nbrowser --backend minimal hover 'button.submit'\n// after\nbrowser --backend playwright hover 'button.submit'","handlingStrategy":"type-guard","validationCode":"const page = await getBrowserPage();\nif (typeof page.hover !== 'function') {\n  throw new Error('Current backend cannot hover; use --backend playwright');\n}","typeGuard":"function supportsHover(page) {\n  return typeof page?.hover === 'function';\n}","tryCatchPattern":"try {\n  await run(['browser', 'hover', sel]);\n} catch (err) {\n  if (String(err.message).includes('hover is not supported')) {\n    await run(['browser', 'eval', `document.querySelector('${sel}').dispatchEvent(new MouseEvent('mouseover', {bubbles:true}))`]);\n  } else throw err;\n}","preventionTips":["Feature-check page.hover before issuing hover commands.","Pin browser backend config to one that implements mouse APIs.","Document which commands your chosen backend supports.","Wrap capability-dependent commands in a compatibility helper."],"tags":["browser","cli","capability"],"backgroundTag":"unsupported-browser-capability","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}