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

Method fill

playwright/async_api/_generated.py:17993–18044  ·  view source on GitHub ↗

Locator.fill Set a value to the input field. **Usage** ```py await page.get_by_role(\"textbox\").fill(\"example value\") ``` **Details** This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, focuse

(
        self,
        value: str,
        *,
        timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
        no_wait_after: typing.Optional[bool] = None,
        force: typing.Optional[bool] = None,
    )

Source from the content-addressed store, hash-verified

17991 )
17992
17993 async def fill(
17994 self,
17995 value: str,
17996 *,
17997 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
17998 no_wait_after: typing.Optional[bool] = None,
17999 force: typing.Optional[bool] = None,
18000 ) -> None:
18001 """Locator.fill
18002
18003 Set a value to the input field.
18004
18005 **Usage**
18006
18007 ```py
18008 await page.get_by_role(\"textbox\").fill(\"example value\")
18009 ```
18010
18011 **Details**
18012
18013 This method waits for [actionability](https://playwright.dev/python/docs/actionability) checks, focuses the element, fills it and triggers an
18014 `input` event after filling. Note that you can pass an empty string to clear the input field.
18015
18016 If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an
18017 error. However, if the element is inside the `<label>` element that has an associated
18018 [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
18019 instead.
18020
18021 To send fine-grained keyboard events, use `locator.press_sequentially()`.
18022
18023 Parameters
18024 ----------
18025 value : str
18026 Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.
18027 timeout : Union[float, None]
18028 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
18029 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
18030 no_wait_after : Union[bool, None]
18031 This option has no effect.
18032 Deprecated: This option has no effect.
18033 force : Union[bool, None]
18034 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
18035 """
18036
18037 return mapping.from_maybe_impl(
18038 await self._impl_obj.fill(
18039 value=value,
18040 timeout=to_milliseconds(timeout),
18041 noWaitAfter=no_wait_after,
18042 force=force,
18043 )
18044 )
18045
18046 async def clear(
18047 self,

Callers

nothing calls this directly

Calls 3

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
fillMethod · 0.45

Tested by

no test coverage detected