MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / typeCharacter

Function typeCharacter

javascript/atoms/typescript/type.ts:179–189  ·  view source on GitHub ↗
(keyboard: Keyboard, ch: string)

Source from the content-addressed store, hash-verified

177
178// Shift is held around a character that needs it, unless already held.
179function typeCharacter(keyboard: Keyboard, ch: string): void {
180 const { key, shift } = fromChar(ch)
181 const addShift = shift && !keyboard.isPressed(Keys.SHIFT)
182 if (addShift) {
183 keyboard.pressKey(Keys.SHIFT)
184 }
185 tap(keyboard, key)
186 if (addShift) {
187 keyboard.releaseKey(Keys.SHIFT)
188 }
189}
190
191// Whether the input accepted `text` as its value. A value the control would
192// sanitise away is rejected and left to the keyboard, as before. A colour

Callers 1

typeFunction · 0.85

Calls 5

fromCharFunction · 0.85
tapFunction · 0.85
isPressedMethod · 0.80
pressKeyMethod · 0.80
releaseKeyMethod · 0.80

Tested by

no test coverage detected