Frame.select_option This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks, waits until all specified options are present in the ` ` element and selects these options. If the target ele
(
self,
selector: str,
value: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
*,
index: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
label: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
element: typing.Optional[
typing.Union["ElementHandle", typing.Sequence["ElementHandle"]]
] = None,
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,
)
| 5597 | ) |
| 5598 | |
| 5599 | async def select_option( |
| 5600 | self, |
| 5601 | selector: str, |
| 5602 | value: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, |
| 5603 | *, |
| 5604 | index: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None, |
| 5605 | label: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, |
| 5606 | element: typing.Optional[ |
| 5607 | typing.Union["ElementHandle", typing.Sequence["ElementHandle"]] |
| 5608 | ] = None, |
| 5609 | timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None, |
| 5610 | no_wait_after: typing.Optional[bool] = None, |
| 5611 | strict: typing.Optional[bool] = None, |
| 5612 | force: typing.Optional[bool] = None, |
| 5613 | ) -> typing.List[str]: |
| 5614 | """Frame.select_option |
| 5615 | |
| 5616 | This method waits for an element matching `selector`, waits for [actionability](https://playwright.dev/python/docs/actionability) checks, waits |
| 5617 | until all specified options are present in the `<select>` element and selects these options. |
| 5618 | |
| 5619 | If the target element is not a `<select>` element, this method throws an error. However, if the element is inside |
| 5620 | the `<label>` element that has an associated |
| 5621 | [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used |
| 5622 | instead. |
| 5623 | |
| 5624 | Returns the array of option values that have been successfully selected. |
| 5625 | |
| 5626 | Triggers a `change` and `input` event once all the provided options have been selected. |
| 5627 | |
| 5628 | **Usage** |
| 5629 | |
| 5630 | ```py |
| 5631 | # Single selection matching the value or label |
| 5632 | await frame.select_option(\"select#colors\", \"blue\") |
| 5633 | # single selection matching the label |
| 5634 | await frame.select_option(\"select#colors\", label=\"blue\") |
| 5635 | # multiple selection |
| 5636 | await frame.select_option(\"select#colors\", value=[\"red\", \"green\", \"blue\"]) |
| 5637 | ``` |
| 5638 | |
| 5639 | Parameters |
| 5640 | ---------- |
| 5641 | selector : str |
| 5642 | A selector to query for. |
| 5643 | value : Union[Sequence[str], str, None] |
| 5644 | Options to select by value. If the `<select>` has the `multiple` attribute, all given options are selected, |
| 5645 | otherwise only the first option matching one of the passed options is selected. Optional. |
| 5646 | index : Union[Sequence[int], int, None] |
| 5647 | Options to select by index. Optional. |
| 5648 | label : Union[Sequence[str], str, None] |
| 5649 | Options to select by label. If the `<select>` has the `multiple` attribute, all given options are selected, |
| 5650 | otherwise only the first option matching one of the passed options is selected. Optional. |
| 5651 | element : Union[ElementHandle, Sequence[ElementHandle], None] |
| 5652 | Option elements to select. Optional. |
| 5653 | timeout : Union[float, None] |
| 5654 | Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can |
| 5655 | be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. |
| 5656 | no_wait_after : Union[bool, None] |
nothing calls this directly
no test coverage detected