UNPKG

@luminati-io/webdriverio8

Version:

Next-gen browser and mobile automation test framework for Node.js

30 lines 1.63 kB
/** * * 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', async () => { const inputUser = await $('#username'); const value = await inputUser.getValue(); console.log(value); // outputs: "John Doe" }); * </example> * * @alias element.getValue * @return {String} requested element(s) value * @uses protocol/elements, protocol/elementIdProperty * */ export 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'); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0VmFsdWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbWFuZHMvZWxlbWVudC9nZXRWYWx1ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBcUJHO0FBQ0gsTUFBTSxVQUFVLFFBQVE7SUFDcEIscUZBQXFGO0lBQ3JGLElBQUksSUFBSSxDQUFDLEtBQUssSUFBSSxDQUFDLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQztRQUMvQixPQUFPLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxDQUFBO0lBQzNELENBQUM7SUFFRCxPQUFPLElBQUksQ0FBQyxtQkFBbUIsQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxDQUFBO0FBQzVELENBQUMifQ==