getValue
Pobierz wartość elementu <textarea>
, <select>
lub tekstowego <input>
znalezionego za pomocą podanego selektora.
Jeśli zostanie znalezionych wiele elementów za pomocą podanego selektora, zwracana jest tablica wartości.
Dla inputów typu checkbox lub radio użyj isSelected.
Użycie
$(selector).getValue()
Przykłady
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"
});
Zwraca
- <String>
return
: wartość żądanego elementu(ów)