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 | 3x 1x 2x | /**
*
* Get the value of a `<textarea>`, `<select>` or text `<input>` found by given selector.
* If multiple elements are found via the given selector, an array of values is returned instead.
* For input with checkbox or radio type use isSelected.
*
* <example>
:index.html
<input type="text" value="John Doe" id="username">
:getValue.js
it('should demonstrate the getValue command', () => {
const inputUser = $('#username');
const value = inputUser.getValue();
console.log(value); // outputs: "John Doe"
});
* </example>
*
* @alias element.getValue
* @return {String} requested element(s) value
* @uses protocol/elements, protocol/elementIdProperty
* @type property
*
*/
export default function getValue () {
// `!this.isMobile` added to workaround https://github.com/appium/appium/issues/12218
if (this.isW3C && !this.isMobile) {
return this.getElementProperty(this.elementId, 'value')
}
return this.getElementAttribute(this.elementId, 'value')
}
|