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

Method hover

playwright/async_api/_generated.py:19098–19165  ·  view source on GitHub ↗

Locator.hover Hover over the matching element. **Usage** ```py await page.get_by_role(\"link\").hover() ``` **Details** This method hovers over the element by performing the following steps: 1. Wait for [actionability](https://play

(
        self,
        *,
        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,
        trial: typing.Optional[bool] = None,
    )

Source from the content-addressed store, hash-verified

19096 )
19097
19098 async def hover(
19099 self,
19100 *,
19101 modifiers: typing.Optional[
19102 typing.Sequence[Literal["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]]
19103 ] = None,
19104 position: typing.Optional[Position] = None,
19105 timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
19106 no_wait_after: typing.Optional[bool] = None,
19107 force: typing.Optional[bool] = None,
19108 trial: typing.Optional[bool] = None,
19109 ) -> None:
19110 """Locator.hover
19111
19112 Hover over the matching element.
19113
19114 **Usage**
19115
19116 ```py
19117 await page.get_by_role(\"link\").hover()
19118 ```
19119
19120 **Details**
19121
19122 This method hovers over the element by performing the following steps:
19123 1. Wait for [actionability](https://playwright.dev/python/docs/actionability) checks on the element, unless `force` option is set.
19124 1. Scroll the element into view if needed.
19125 1. Use `page.mouse` to hover over the center of the element, or the specified `position`.
19126
19127 If the element is detached from the DOM at any moment during the action, this method throws.
19128
19129 When all steps combined have not finished during the specified `timeout`, this method throws a `TimeoutError`.
19130 Passing zero timeout disables this.
19131
19132 Parameters
19133 ----------
19134 modifiers : Union[Sequence[Union["Alt", "Control", "ControlOrMeta", "Meta", "Shift"]], None]
19135 Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores
19136 current modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to
19137 "Control" on Windows and Linux and to "Meta" on macOS.
19138 position : Union[{x: float, y: float}, None]
19139 A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of
19140 the element.
19141 timeout : Union[float, None]
19142 Maximum time in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can
19143 be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods.
19144 no_wait_after : Union[bool, None]
19145 This option has no effect.
19146 Deprecated: This option has no effect.
19147 force : Union[bool, None]
19148 Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
19149 trial : Union[bool, None]
19150 When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults
19151 to `false`. Useful to wait until the element is ready for the action without performing it. Note that keyboard
19152 `modifiers` will be pressed regardless of `trial` to allow testing elements which are only visible when those keys
19153 are pressed.
19154 """
19155

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