obtenerValor
Obtiene el valor de un <textarea>
, <select>
o <input>
de texto encontrado por el selector dado.
Si se encuentran múltiples elementos a través del selector dado, se devuelve un array de valores en su lugar.
Para inputs con tipo checkbox o radio, use isSelected.
Uso
$(selector).getValue()
Ejemplos
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"
});
Devuelve
- <String>
return
: valor del elemento(s) solicitado