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

Method hover

playwright/async_api/_generated.py:5466–5533  ·  view source on GitHub ↗

Frame.hover This method hovers over an element matching `selector` by performing the following steps: 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM. 1. Wait for [actionability](https://playwright.dev/python/doc

(
        self,
        selector: str,
        *,
        modifiers: typing.Optional[
            typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
        ] = None,
        position: typing.Optional[Position] = None,
        timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
        no_wait_after: typing.Optional[bool] = None,
        force: typing.Optional[bool] = None,
        strict: typing.Optional[bool] = None,
        trial: typing.Optional[bool] = None,
    )

Source from the content-addressed store, hash-verified

5464 )
5465
5466 async def hover(
5467 self,
5468 selector: str,
5469 *,
5470 modifiers: typing.Optional[
5471 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
5472 ] = None,
5473 position: typing.Optional[Position] = None,
5474 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
5475 no_wait_after: typing.Optional[bool] = None,
5476 force: typing.Optional[bool] = None,
5477 strict: typing.Optional[bool] = None,
5478 trial: typing.Optional[bool] = None,
5479 ) -> None:
5480 """Frame.hover
5481
5482 This method hovers over an element matching `selector` by performing the following steps:
5483 1. Find an element matching `selector`. If there is none, wait until a matching element is attached to the DOM.
5484 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the matched element, unless `force` option is set. If
5485 the element is detached during the checks, the whole action is retried.
5486 1. Scroll the element into view if needed.
5487 1. Use `page.mouse` to hover over the center of the element, or the specified `position`.
5488
5489 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
5490 Passing zero timeout disables this.
5491
5492 Parameters
5493 ----------
5494 selector : str
5495 A selector to search for an element. If there are multiple elements satisfying the selector, the first will be
5496 used.
5497 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
5498 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
5499 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
5500 "Control" on Windows and Linux and to "Meta" on macOS.
5501 position : Union[{x: float, y: float}, None]
5502 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
5503 the element.
5504 timeout : Union[float, None]
5505 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
5506 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
5507 no_wait_after : Union[bool, None]
5508 This option has no effect.
5509 Deprecated: This option has no effect.
5510 force : Union[bool, None]
5511 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
5512 strict : Union[bool, None]
5513 When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
5514 element, the call throws an exception.
5515 trial : Union[bool, None]
5516 When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
5517 to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
5518 `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
5519 are pressed.
5520 """
5521
5522 return mapping.from_maybe_impl(
5523 await self._impl_obj.hover(

Callers

nothing calls this directly

Calls 4

to_millisecondsFunction · 0.90
from_maybe_implMethod · 0.80
to_implMethod · 0.80
hoverMethod · 0.45

Tested by

no test coverage detected