MCPcopy Index your code
hub / github.com/microsoft/playwright-python / input_value

Method input_value

playwright/async_api/_generated.py:19218–19256  ·  view source on GitHub ↗

Locator.input_value Returns the value for the matching ` ` or ` ` or ` ` element. **NOTE** If you need to assert input value, prefer `locator_assertions.to_have_value()` to avoid flakiness. See [assertions guide](https://playwright.dev/python/docs/test

(
        self,
        *,
        timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
    )

Source from the content-addressed store, hash-verified

19216 )
19217
19218 async def input_value(
19219 self,
19220 *,
19221 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
19222 ) -> str:
19223 """Locator.input_value
19224
19225 Returns the value for the matching `<input>` or `<textarea>` or `<select>` element.
19226
19227 **NOTE** If you need to assert input value, prefer `locator_assertions.to_have_value()` to avoid flakiness.
19228 See [assertions guide](https://playwright.dev/python/docs/test-assertions) for more details.
19229
19230 **Usage**
19231
19232 ```py
19233 value = await page.get_by_role(\"textbox\").input_value()
19234 ```
19235
19236 **Details**
19237
19238 Throws elements that are not an input, textarea or a select. However, if the element is inside the `<label>`
19239 element that has an associated
19240 [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), returns the value of the
19241 control.
19242
19243 Parameters
19244 ----------
19245 timeout : Union[float, None]
19246 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
19247 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
19248
19249 Returns
19250 -------
19251 str
19252 """
19253
19254 return mapping.from_maybe_impl(
19255 await self._impl_obj.input_value(timeout=to_milliseconds(timeout))
19256 )
19257
19258 async def is_checked(
19259 self,

Callers

nothing calls this directly

Calls 3

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
input_valueMethod · 0.45

Tested by

no test coverage detected