{"record":{"id":"e4116bbce664dc47","repo":"jackwener/OpenCLI","slug":"browser-bridge-native-click-support-is-required-fo","errorCode":null,"errorMessage":"Browser Bridge native click support is required for Creation Actions","messagePattern":"Browser Bridge native click support is required for Creation Actions","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":1220,"sourceCode":"    const visible = (element) => {\n      const rect = element.getBoundingClientRect();\n      const style = getComputedStyle(element);\n      return rect.width > 0 && rect.height > 0 && style.visibility !== 'hidden' && style.display !== 'none';\n    };\n    const close = [...document.querySelectorAll('button[title=\"Close\"]')].filter(visible).at(-1);\n    const scope = close?.parentElement?.parentElement;\n    if (!scope) return { ok: false, reason: 'job detail scope not found' };\n    const matches = [...scope.querySelectorAll('button')]\n      .filter(visible)\n      .filter((button) => String(button.textContent || '').replace(/\\s+/g, ' ').trim() === label);\n    const button = matches[wantedIndex];\n    if (!button) return { ok: false, reason: `button ${label} occurrence ${wantedIndex} not found`, count: matches.length };\n    if (button.disabled) return { ok: false, reason: `button ${label} is disabled`, count: matches.length };\n    const rect = button.getBoundingClientRect();\n    return { ok: true, x: rect.left + rect.width / 2, y: rect.top + rect.height / 2, count: matches.length };\n  }, normalizeButtonText(text), occurrence));\n  if (!target?.ok) throw new CommandExecutionError(`Midjourney Creation Action unavailable: ${target?.reason || text}`);\n  if (typeof page.nativeClick !== 'function') throw new CommandExecutionError('Browser Bridge native click support is required for Creation Actions');\n  await page.nativeClick(target.x, target.y);\n  return target;\n}\n\nexport async function clickVisibleControl(page, label) {\n  const target = unwrapEvaluateResult(await page.evaluate((wanted) => {\n    const visible = (element) => {\n      const rect = element.getBoundingClientRect();\n      return rect.width > 0 && rect.height > 0 && getComputedStyle(element).display !== 'none';\n    };\n    const button = [...document.querySelectorAll('button')].find((node) => visible(node) && (\n      node.textContent?.trim().replace(/\\s+/g, ' ') === wanted\n      || node.title === wanted\n      || node.getAttribute('aria-label') === wanted\n    ));\n    if (!button || button.disabled) return null;\n    const rect = button.getBoundingClientRect();\n    return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };","sourceCodeStart":1202,"sourceCodeEnd":1238,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L1202-L1238","documentation":"CommandExecutionError thrown when the page object does not implement page.nativeClick, which is required to synthesize trusted mouse events at real coordinates for Creation Action buttons. Ordinary evaluate-based clicks are insufficient here.","triggerScenarios":"clickCreationAction succeeded in locating the button coordinates, but typeof page.nativeClick !== 'function' (older Bridge or non-Bridge page object).","commonSituations":"Outdated Browser Bridge; raw puppeteer/playwright page passed in; test mocks without nativeClick stub.","solutions":["Update the Browser Bridge extension/client to a version with nativeClick support.","Pass the Bridge-wrapped page object rather than a raw automation page.","For tests, stub page.nativeClick(x, y).","Fall back to page.click on the button selector if trusted events aren't strictly required."],"exampleFix":"// before\nawait clickCreationAction(plainPage, 'Upscale', 1);\n// after\nconst page = await bridge.attach(tabId); // has nativeClick\nawait clickCreationAction(page, 'Upscale', 1);","handlingStrategy":"type-guard","validationCode":"if (typeof page.nativeClick !== 'function') {\n  throw new Error('Browser Bridge with nativeClick is required for Creation Actions');\n}","typeGuard":"function supportsNativeClick(page) { return typeof page?.nativeClick === 'function'; }","tryCatchPattern":"try {\n  await clickCreationAction(page, 'Upscale', 0);\n} catch (err) {\n  if (String(err.message).includes('native click')) {\n    const bridge = await require('./bridge').attach(tabId);\n    await clickCreationAction(bridge, 'Upscale', 0);\n  } else throw err;\n}","preventionTips":["Always use the Bridge-wrapped page for creation actions","Update the Bridge extension for nativeClick support","Stub nativeClick in tests","Feature-check page.nativeClick before calling"],"tags":["midjourney","browser-bridge","native-click","compatibility"],"backgroundTag":"bridge-capability-missing","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}