{"record":{"id":"ad9d5dd3d4faa79f","repo":"grafana/k6","slug":"parsing-selector-q-w","errorCode":null,"errorMessage":"parsing selector %q: %w","messagePattern":"parsing selector %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1192,"sourceCode":"\t}\n\tpressAction := h.newAction(\n\t\t[]string{}, press, false, withRetry, opts.NoWaitAfter, opts.Timeout,\n\t)\n\tif _, err := call(h.ctx, pressAction, opts.Timeout); err != nil {\n\t\treturn fmt.Errorf(\"pressing %q on element: %w\", key, err)\n\t}\n\n\tapplySlowMo(h.ctx)\n\n\treturn nil\n}\n\n// Query runs \"element.querySelector\" within the page. If no element matches the selector,\n// the return value resolves to \"null\".\nfunc (h *ElementHandle) Query(selector string, strict bool) (_ *ElementHandle, rerr error) {\n\tparsedSelector, err := NewSelector(selector)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing selector %q: %w\", selector, err)\n\t}\n\n\t// Check for frame navigation in the selector\n\tframeNavIndex := h.findFrameNavigationIndex(parsedSelector)\n\tif frameNavIndex != -1 {\n\t\t// Strict is true because we assume the user is interested in the element\n\t\t// in the frame and not the frame it is in.\n\t\topts := &FrameWaitForSelectorOptions{\n\t\t\tState:   DOMElementStateAttached,\n\t\t\tTimeout: h.frame.defaultTimeout(),\n\t\t\tStrict:  true,\n\t\t}\n\n\t\tframe, afterFrameSelector, err := h.stepIntoFrame(h.ctx, parsedSelector, frameNavIndex, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n","sourceCodeStart":1174,"sourceCodeEnd":1210,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/element_handle.go#L1174-L1210","documentation":"Returned by ElementHandle.Query when NewSelector rejects the selector string during parsing. This is a user-input validation error: the selector is syntactically invalid for k6's selector engine (e.g. malformed combination of engine=selector parts, unclosed quotes or parens), before any DOM lookup happens.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/element_handle.go:1192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the selector syntax; use valid selector engine prefixes like 'css=', 'xpath=', 'text='","Quote text selectors containing special characters","Test the selector in browser devtools or with a simpler css selector first"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}