{"record":{"id":"e6c459ecb5351312","repo":"grafana/k6","slug":"selecting-option-on-q-w-e6c459","errorCode":null,"errorMessage":"selecting option on %q: %w","messagePattern":"selecting option on %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":530,"sourceCode":"\topts.Strict = true\n\tv, err := l.frame.inputValue(l.selector, opts)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting input value of %q: %w\", l.selector, err)\n\t}\n\n\treturn v, nil\n}\n\n// SelectOption filters option values of the first element that matches\n// the locator's selector (with strict mode on), selects the options,\n// and returns the filtered options.\nfunc (l *Locator) SelectOption(values []any, opts *FrameSelectOptionOptions) ([]string, error) {\n\tl.log.Debugf(\"Locator:SelectOption\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\tv, err := l.frame.selectOption(l.selector, values, opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"selecting option on %q: %w\", l.selector, err)\n\t}\n\n\tapplySlowMo(l.ctx)\n\n\treturn v, nil\n}\n\n// Press the given key on the element found that matches the locator's\n// selector with strict mode on.\nfunc (l *Locator) Press(key string, opts *FramePressOptions) error {\n\tl.log.Debugf(\n\t\t\"Locator:Press\", \"fid:%s furl:%q sel:%q key:%q opts:%+v\",\n\t\tl.frame.ID(), l.frame.URL(), l.selector, key, opts,\n\t)\n\n\topts.Strict = true\n\tif err := l.frame.press(l.selector, key, opts); err != nil {\n\t\treturn fmt.Errorf(\"pressing %q on %q: %w\", key, l.selector, err)","sourceCodeStart":512,"sourceCodeEnd":548,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L512-L548","documentation":"Wrapped failure from Frame.selectOption while selecting options on the element matched by the locator's selector (strict mode forced). Fires when the selector matches zero/multiple elements, the target is not a select element, none of the requested options exist, or the CDP selection call fails.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:530 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the target is a <select> element matched by a unique selector","Verify the option values/labels passed actually exist in the select","Wait for the options to be populated (e.g. after async load) before selecting"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}