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

Method fill

playwright/async_api/_generated.py:4682–4734  ·  view source on GitHub ↗

Frame.fill This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the

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

Source from the content-addressed store, hash-verified

4680 )
4681
4682 async def fill(
4683 self,
4684 selector: str,
4685 value: str,
4686 *,
4687 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
4688 no_wait_after: typing.Optional[bool] = None,
4689 strict: typing.Optional[bool] = None,
4690 force: typing.Optional[bool] = None,
4691 ) -> None:
4692 """Frame.fill
4693
4694 This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks,
4695 focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string
4696 to clear the input field.
4697
4698 If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an
4699 error. However, if the element is inside the `<label>` element that has an associated
4700 [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled
4701 instead.
4702
4703 To send fine-grained keyboard events, use `locator.press_sequentially()`.
4704
4705 Parameters
4706 ----------
4707 selector : str
4708 A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
4709 used.
4710 value : str
4711 Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
4712 timeout : Union[float, None]
4713 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
4714 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
4715 no_wait_after : Union[bool, None]
4716 This option has no effect.
4717 Deprecated: This option has no effect.
4718 strict : Union[bool, None]
4719 When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
4720 element, the call throws an exception.
4721 force : Union[bool, None]
4722 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
4723 """
4724
4725 return mapping.from_maybe_impl(
4726 await self._impl_obj.fill(
4727 selector=selector,
4728 value=value,
4729 timeout=to_milliseconds(timeout),
4730 noWaitAfter=no_wait_after,
4731 strict=strict,
4732 force=force,
4733 )
4734 )
4735
4736 def locator(
4737 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