* * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)). * * {{> pressKeyWithKeyNormalization }}
(key)
| 2225 | * {{> pressKeyWithKeyNormalization }} |
| 2226 | */ |
| 2227 | async pressKey(key) { |
| 2228 | await checkFocusBeforePressKey(this, key) |
| 2229 | const modifiers = [] |
| 2230 | if (Array.isArray(key)) { |
| 2231 | for (let k of key) { |
| 2232 | k = getNormalizedKey.call(this, k) |
| 2233 | if (isModifierKey(k)) { |
| 2234 | modifiers.push(k) |
| 2235 | } else { |
| 2236 | key = k |
| 2237 | break |
| 2238 | } |
| 2239 | } |
| 2240 | } else { |
| 2241 | key = getNormalizedKey.call(this, key) |
| 2242 | } |
| 2243 | for (const modifier of modifiers) { |
| 2244 | await this.page.keyboard.down(modifier) |
| 2245 | } |
| 2246 | await this.page.keyboard.press(key) |
| 2247 | for (const modifier of modifiers) { |
| 2248 | await this.page.keyboard.up(modifier) |
| 2249 | } |
| 2250 | return this._waitForAction() |
| 2251 | } |
| 2252 | |
| 2253 | /** |
| 2254 | * {{> type }} |
nothing calls this directly
no test coverage detected