Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 19x 5x 14x 5x 9x | /**
*
* Add a value to an object found by given selector. You can also use unicode
* characters like Left arrow or Back space. WebdriverIO will take care of
* translating them into unicode characters. You’ll find all supported characters
* [here](https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions).
* To do that, the value has to correspond to a key from the table.
*
* <example>
:addValue.js
it('should demonstrate the addValue command', () => {
let input = $('.input')
input.addValue('test')
input.addValue(123)
value = input.getValue()
assert(value === 'test123') // true
})
* </example>
*
* @alias element.addValue
* @param {string | number | boolean | object | Array<any>} value value to be added
* @uses protocol/elements, protocol/elementIdValue
* @type action
*
*/
import { transformToCharString } from '../../utils'
export default function addValue (value) {
if (!this.isW3C) {
return this.elementSendKeys(this.elementId, transformToCharString(value))
}
// Workaround https://github.com/appium/appium/issues/12085
if (this.isMobile) {
return this.elementSendKeys(this.elementId, transformToCharString(value).join(''), transformToCharString(value))
}
return this.elementSendKeys(this.elementId, transformToCharString(value).join(''))
}
|