{"record":{"id":"6db0dcff8e92281b","repo":"garrytan/gstack","slug":"cannot-click-option-elements-use-browse-select","errorCode":null,"errorMessage":"Cannot click <option> elements. Use 'browse select <parent-select> <value>' instead of 'click' for dropdown options.","messagePattern":"Cannot click <option> elements\\. Use 'browse select <parent-select> <value>' instead of 'click' for dropdown options\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/write-commands.ts","lineNumber":364,"sourceCode":"        }\n      }\n\n      const resolved = await session.resolveRef(selector);\n      try {\n        if ('locator' in resolved) {\n          await resolved.locator.click({ timeout: 5000 });\n        } else {\n          await target.locator(resolved.selector).click({ timeout: 5000 });\n        }\n      } catch (err: any) {\n        // Enhanced error guidance: clicking <option> elements always fails (not visible / timeout)\n        const isOption = 'locator' in resolved\n          ? await resolved.locator.evaluate(el => el.tagName === 'OPTION').catch(() => false)\n          : await target.locator(resolved.selector).evaluate(\n              el => el.tagName === 'OPTION'\n            ).catch(() => false);\n        if (isOption) {\n          throw new Error(\n            `Cannot click <option> elements. Use 'browse select <parent-select> <value>' instead of 'click' for dropdown options.`\n          );\n        }\n        throw err;\n      }\n      // Wait for network to settle (catches XHR/fetch triggered by clicks)\n      await page.waitForLoadState('networkidle', { timeout: 2000 }).catch(() => {});\n      return `Clicked ${selector} → now at ${page.url()}`;\n    }\n\n    case 'fill': {\n      const [selector, ...valueParts] = args;\n      const value = valueParts.join(' ');\n      if (!selector || !value) throw new Error('Usage: browse fill <selector> <value>');\n      const resolved = await session.resolveRef(selector);\n      if ('locator' in resolved) {\n        await resolved.locator.fill(value, { timeout: 5000 });\n      } else {","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/write-commands.ts#L346-L382","documentation":"Error \"Cannot click <option> elements. Use 'browse select <parent-select> <value>' instead of 'click' for dropdown options.\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/write-commands.ts:364 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}