* _Note:_ In case a text field or textarea is focused be aware that some browsers do not respect active modifier when combining modifier keys with other keys. * * {{> pressKeyWithKeyNormalization }}
(key)
| 2220 | * {{> pressKeyWithKeyNormalization }} |
| 2221 | */ |
| 2222 | async pressKey(key) { |
| 2223 | await checkFocusBeforePressKey(this, key) |
| 2224 | const modifiers = [] |
| 2225 | if (Array.isArray(key)) { |
| 2226 | for (let k of key) { |
| 2227 | k = getNormalizedKey.call(this, k) |
| 2228 | if (isModifierKey(k)) { |
| 2229 | modifiers.push(k) |
| 2230 | } else { |
| 2231 | key = k |
| 2232 | break |
| 2233 | } |
| 2234 | } |
| 2235 | } else { |
| 2236 | key = getNormalizedKey.call(this, key) |
| 2237 | } |
| 2238 | for (const modifier of modifiers) { |
| 2239 | await this.pressKeyDown(modifier) |
| 2240 | } |
| 2241 | if (!this.browser.isW3C) { |
| 2242 | await this.browser.sendKeys([key]) |
| 2243 | } else { |
| 2244 | await this.browser.performActions([ |
| 2245 | { |
| 2246 | type: 'key', |
| 2247 | id: 'keyboard', |
| 2248 | actions: [ |
| 2249 | { |
| 2250 | type: 'keyDown', |
| 2251 | value: key, |
| 2252 | }, |
| 2253 | { |
| 2254 | type: 'keyUp', |
| 2255 | value: key, |
| 2256 | }, |
| 2257 | ], |
| 2258 | }, |
| 2259 | ]) |
| 2260 | } |
| 2261 | for (const modifier of modifiers) { |
| 2262 | await this.pressKeyUp(modifier) |
| 2263 | } |
| 2264 | } |
| 2265 | |
| 2266 | /** |
| 2267 | * {{> type }} |
nothing calls this directly
no test coverage detected