getValue
指定されたセレクターで見つかった <textarea>
, <select>
またはテキスト <input>
の値を取得します。与えられたセレクターで複数の要素が見つかった場合は、値の配列が代わりに返されます。チェックボックスまたはラジオタイプの入力には、isSelected を使用します。
使い方
$(selector).getValue()
例
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"
});