{"record":{"id":"98aed2ad2d86ed26","repo":"grafana/k6","slug":"name-attribute-must-have-a-value","errorCode":null,"errorMessage":"\"name\" attribute must have a value","messagePattern":"\"name\" attribute must have a value","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/js/injected_script.js","lineNumber":1209,"sourceCode":"      }\n      case \"level\": {\n        validateSupportedRole(attr.name, kAriaLevelRoles, role);\n        if (typeof attr.value === \"string\")\n          attr.value = +attr.value;\n        if (attr.op !== \"=\" || typeof attr.value !== \"number\" || Number.isNaN(attr.value))\n          throw new Error(`\"level\" attribute must be compared to a number`);\n        options.level = attr.value;\n        break;\n      }\n      case \"disabled\": {\n        validateSupportedValues(attr, [true, false]);\n        validateSupportedOp(attr, [\"<truthy>\", \"=\"]);\n        options.disabled = attr.op === \"<truthy>\" ? true : attr.value;\n        break;\n      }\n      case \"name\": {\n        if (attr.op === \"<truthy>\")\n          throw new Error(`\"name\" attribute must have a value`);\n        if (typeof attr.value !== \"string\" && !(attr.value instanceof RegExp))\n          throw new Error(`\"name\" attribute must be a string or a regular expression`);\n        options.name = attr.value;\n        options.nameOp = attr.op;\n        options.exact = attr.caseSensitive;\n        break;\n      }\n      case \"include-hidden\": {\n        validateSupportedValues(attr, [true, false]);\n        validateSupportedOp(attr, [\"<truthy>\", \"=\"]);\n        options.includeHidden = attr.op === \"<truthy>\" ? true : attr.value;\n        break;\n      }\n      default: {\n        throw new Error(`Unknown attribute \"${attr.name}\", must be one of ${kSupportedAttributes.map((a) => `\"${a}\"`).join(\", \")}.`);\n      }\n    }\n  }","sourceCodeStart":1191,"sourceCodeEnd":1227,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/js/injected_script.js#L1191-L1227","documentation":"Frame.InnerText() (frame.go:1330) wraps the innerText action failure with 'getting inner text of %q'. The action waits for a selector match in the attached state within Timeout and then evaluates element.innerText. Failures wrapped here are element/selector timeouts, strict-mode violations, detached frames or destroyed execution contexts during evaluation, and page-side exceptions (e.g., overridden innerText getters throwing).","triggerScenarios":"No element matches before opts.Timeout; multiple matches with Strict:true; navigation/detach between resolution and evaluation; page scripts throwing from a patched innerText getter.","commonSituations":"Reading text of elements populated after async fetches; asserting toast/confirmation text that disappears quickly; querying elements on the wrong frame; React re-renders swapping the node between resolution and read.","solutions":["Wait for the element (and ideally its text) before reading: await page.waitForSelector(sel, { timeout: 10000 }) or use locator(sel).waitFor().","Use resilient, unique selectors (data-testid) so rerenders don't invalidate them.","Call InnerText on the frame that actually owns the element.","Give slow apps more time: page.innerText(sel, { timeout: 60000 })."],"exampleFix":"// before\nconst txt = await page.innerText('.alert');\n\n// after\nconst alert = page.locator('.alert');\nawait alert.waitFor({ state: 'visible', timeout: 10000 });\nconst txt = await alert.innerText();","handlingStrategy":"try-catch","validationCode":"const el = page.locator('.alert');\nawait el.waitFor({ state: 'visible', timeout: 5000 });","typeGuard":null,"tryCatchPattern":"try {\n  return await page.innerText(sel, { timeout: 10000 });\n} catch (e) {\n  if (String(e).startsWith('getting inner text')) return null; // not rendered yet\n  throw e;\n}","preventionTips":["Wait for visible state for transient text (toasts, banners).","Scope selectors uniquely.","Run on the correct frame."],"tags":["k6","browser","frame","innertext","selector","timeout"],"backgroundTag":"element-not-found-timeout","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}