{"record":{"id":"4c1f588a90a05a3f","repo":"angular/components","slug":"no-keys-have-been-specified-4c1f58","errorCode":null,"errorMessage":"No keys have been specified.","messagePattern":"No keys have been specified\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts","lineNumber":128,"sourceCode":"      modifiers = first;\n      rest = modifiersAndKeys.slice(1);\n    } else {\n      modifiers = {};\n      rest = modifiersAndKeys;\n    }\n\n    const modifierKeys = getSeleniumWebDriverModifierKeys(modifiers);\n    const keys = rest\n      .map(k => (typeof k === 'string' ? k.split('') : [seleniumWebDriverKeyMap[k]]))\n      .reduce((arr, k) => arr.concat(k), [])\n      // webdriver.Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),\n      // so avoid it if no modifier keys are required.\n      .map(k => (modifierKeys.length > 0 ? webdriver.Key.chord(...modifierKeys, k) : k));\n\n    // Throw an error if no keys have been specified. Calling this function with no\n    // keys should not result in a focus event being dispatched unexpectedly.\n    if (keys.length === 0) {\n      throw getNoKeysSpecifiedError();\n    }\n\n    await this.element().sendKeys(...keys);\n    await this._stabilize();\n  }\n\n  /**\n   * Gets the text from the element.\n   * @param options Options that affect what text is included.\n   */\n  async text(options?: TextOptions): Promise<string> {\n    await this._stabilize();\n    if (options?.exclude) {\n      return this._executeScript(_getTextWithExcludedElements, this.element(), options.exclude);\n    }\n    // We don't go through the WebDriver `getText`, because it excludes text from hidden elements.\n    return this._executeScript(\n      (element: Element) => (element.textContent || '').trim(),","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts#L110-L146","documentation":"Thrown by SeleniumWebDriverElement.sendKeys when the effective keys array is empty. As with the Protractor variant, sending zero keys would still dispatch a focus event as a side effect, so the library throws getNoKeysSpecifiedError before touching the driver.","triggerScenarios":"Calling await element.sendKeys() with no arguments, or sendKeys(...keys) with an empty array; also key lists built from conditions that filtered everything out.","commonSituations":"Generic e2e helpers whose key parameter defaults to []/undefined; tests that pass only modifier key names without an actual key to press.","solutions":["Always pass at least one key/character to sendKeys.","Guard the call with if (keys.length) before spreading an array.","Use driver-level Key.chord for modifier-only intentions plus a real key."],"exampleFix":"// before\nawait element.sendKeys(...keys);\n// after\nif (!keys.length) throw new Error('keys required');\nawait element.sendKeys(...keys);","handlingStrategy":"validation","validationCode":"if (!keys || keys.length === 0) return;\nawait element.sendKeys(...keys);","typeGuard":"const hasKeys = (k: string[] | undefined): k is [string, ...string[]] => Array.isArray(k) && k.length > 0;","tryCatchPattern":"try { await element.sendKeys(...keys); } catch (e) { if ((e as Error).message.includes('No keys have been specified')) return; throw e; }","preventionTips":["Default key arrays to a sensible value instead of []","Combine modifiers with a real key via Key.chord"],"tags":["angular-cdk","testing","selenium-webdriver","keyboard-input"],"backgroundTag":"no-keys-specified","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}