getValue
Obtenha o valor de um <textarea>
, <select>
ou <input>
de texto encontrado pelo seletor fornecido.
Se vários elementos forem encontrados através do seletor fornecido, um array de valores é retornado.
Para inputs do tipo checkbox ou radio, use isSelected.
Uso
$(selector).getValue()
Exemplos
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"
});
Retorna
- <String>
return
: valor do(s) elemento(s) solicitado(s)