{"record":{"id":"18b4f9686d8c2ffe","repo":"jackwener/OpenCLI","slug":"visible-midjourney-settings-control-was-not-found","errorCode":null,"errorMessage":"Visible Midjourney Settings control was not found","messagePattern":"Visible Midjourney Settings control was not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":1303,"sourceCode":"    ));\n    if (labeled) {\n      const rect = labeled.getBoundingClientRect();\n      return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };\n    }\n    const input = document.querySelector('#desktop_input_bar');\n    let root = input?.parentElement;\n    for (let depth = 0; depth < 4 && root; depth += 1, root = root.parentElement) {\n      const buttons = [...root.querySelectorAll('button')].filter(visible);\n      const nonImage = buttons.filter((button) => button.getAttribute('aria-label') !== 'Add Images');\n      if (buttons.some((button) => button.getAttribute('aria-label') === 'Add Images') && nonImage.length) {\n        const button = nonImage.at(-1);\n        const rect = button.getBoundingClientRect();\n        return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };\n      }\n    }\n    return null;\n  }));\n  if (!target) throw new CommandExecutionError('Visible Midjourney Settings control was not found');\n  if (typeof page.nativeClick !== 'function') throw new CommandExecutionError('Browser Bridge native click support is required');\n  await page.nativeClick(target.x, target.y);\n  await page.wait(0.4);\n}\n\nexport async function isSettingsPanelVisible(page) {\n  return Boolean(unwrapEvaluateResult(await page.evaluate(() => {\n    const visible = (element) => {\n      const rect = element.getBoundingClientRect();\n      return rect.width > 0 && rect.height > 0 && getComputedStyle(element).display !== 'none';\n    };\n    const label = document.querySelector('a[href*=\"GPU-Speed\"]');\n    const fast = [...document.querySelectorAll('button')].find((node) => node.textContent?.trim() === 'Fast' && visible(node));\n    return Boolean((label && visible(label)) || fast);\n  })));\n}\n\nexport async function ensureImageComposer(page) {","sourceCodeStart":1285,"sourceCodeEnd":1321,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L1285-L1321","documentation":"CommandExecutionError from toggleSettingsPanel. The helper scans the page for a visible Midjourney 'Settings' control and computes its coordinates; when no visible matching button is found it throws instead of clicking blindly.","triggerScenarios":"Calling toggleSettingsPanel(page) when the Settings button is absent, hidden behind another panel/overlay, scrolled out with different visibility rules, or the UI text/structure no longer matches the lookup heuristic.","commonSituations":"A settings panel or modal is already open covering the button; page not fully loaded; Midjourney redesign renaming the control; running on a page variant (e.g. video tab) without the Settings control.","solutions":["Ensure no modal/panel is open and the main Midjourney UI is fully loaded before toggling","Close any already-open settings panel first (check isSettingsPanelVisible)","Wait longer for page render (page.wait) and retry","Update the CLI to match current Midjourney markup"],"exampleFix":"// before\nawait toggleSettingsPanel(page);\n// after\nif (await isSettingsPanelVisible(page)) {\n  // panel already open; skip opening\n} else {\n  await page.wait(1.0);\n  await toggleSettingsPanel(page);\n}","handlingStrategy":"try-catch","validationCode":"const visible = await isSettingsPanelVisible(page);\nif (!visible && !(await page.$('button, [role=button]'))) throw new Error('Page UI not loaded');","typeGuard":null,"tryCatchPattern":"try {\n  await toggleSettingsPanel(page);\n} catch (e) {\n  if (String(e.message).includes('Settings control')) {\n    await page.wait(2);\n    await toggleSettingsPanel(page);\n  } else throw e;\n}","preventionTips":["Ensure no overlay/modal is open before toggling","Wait for full page render before interacting","Check isSettingsPanelVisible first to avoid redundant toggles","Update CLI when Midjourney ships UI redesigns"],"tags":["browser-automation","dom-selector","midjourney"],"backgroundTag":"dom-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}