پرش به محتوای اصلی

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"
});
برگشتی‌ها
  • <String> return: مقدار عنصر(های) درخواست شده

Welcome! How can I help?

WebdriverIO AI Copilot