Page.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,
)
| 11065 | ) |
| 11066 | |
| 11067 | async def fill( |
| 11068 | self, |
| 11069 | selector: str, |
| 11070 | value: str, |
| 11071 | *, |
| 11072 | timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None, |
| 11073 | no_wait_after: typing.Optional[bool] = None, |
| 11074 | strict: typing.Optional[bool] = None, |
| 11075 | force: typing.Optional[bool] = None, |
| 11076 | ) -> None: |
| 11077 | """Page.fill |
| 11078 | |
| 11079 | This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks, |
| 11080 | focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string |
| 11081 | to clear the input field. |
| 11082 | |
| 11083 | If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an |
| 11084 | error. However, if the element is inside the `<label>` element that has an associated |
| 11085 | [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled |
| 11086 | instead. |
| 11087 | |
| 11088 | To send fine-grained keyboard events, use `locator.press_sequentially()`. |
| 11089 | |
| 11090 | Parameters |
| 11091 | ---------- |
| 11092 | selector : str |
| 11093 | A selector to search for an element. If there are multiple elements satisfying the selector, the first will be |
| 11094 | used. |
| 11095 | value : str |
| 11096 | Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element. |
| 11097 | timeout : Union[float, None] |
| 11098 | Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can |
| 11099 | be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. |
| 11100 | no_wait_after : Union[bool, None] |
| 11101 | This option has no effect. |
| 11102 | Deprecated: This option has no effect. |
| 11103 | strict : Union[bool, None] |
| 11104 | When true, the call requires selector to resolve to a single element. If given selector resolves to more than one |
| 11105 | element, the call throws an exception. |
| 11106 | force : Union[bool, None] |
| 11107 | Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. |
| 11108 | """ |
| 11109 | |
| 11110 | return mapping.from_maybe_impl( |
| 11111 | await self._impl_obj.fill( |
| 11112 | selector=selector, |
| 11113 | value=value, |
| 11114 | timeout=to_milliseconds(timeout), |
| 11115 | noWaitAfter=no_wait_after, |
| 11116 | strict=strict, |
| 11117 | force=force, |
| 11118 | ) |
| 11119 | ) |
| 11120 | |
| 11121 | def locator( |
| 11122 | self, |
no test coverage detected