(
self,
selector: str,
force: Optional[bool] = False,
modifiers: Optional[Sequence[Literal["Alt", "Control", "Meta", "Shift"]]] = None,
position: Optional[Position] = None,
strict: Optional[bool] = False,
timeout: Optional[float] = None,
trial: Optional[bool] = False,
no_wait_after: Optional[bool] = None,
)
| 375 | assert await element.is_checked(), PlaywrightError |
| 376 | |
| 377 | async def hover( |
| 378 | self, |
| 379 | selector: str, |
| 380 | force: Optional[bool] = False, |
| 381 | modifiers: Optional[Sequence[Literal["Alt", "Control", "Meta", "Shift"]]] = None, |
| 382 | position: Optional[Position] = None, |
| 383 | strict: Optional[bool] = False, |
| 384 | timeout: Optional[float] = None, |
| 385 | trial: Optional[bool] = False, |
| 386 | no_wait_after: Optional[bool] = None, |
| 387 | ) -> None: |
| 388 | modifiers = modifiers or [] |
| 389 | position = position or Position(x=0, y=0) |
| 390 | |
| 391 | element = await self.wait_for_selector(selector, state="visible" if not force else "hidden", strict=strict, timeout=timeout) |
| 392 | if not element: |
| 393 | raise PlaywrightError("Element is not attached to the DOM") |
| 394 | |
| 395 | if not force: |
| 396 | await element.wait_for_element_state("editable", timeout=timeout) |
| 397 | |
| 398 | if not trial: |
| 399 | bounding_box = await element.bounding_box() |
| 400 | if not bounding_box: |
| 401 | raise PlaywrightError("Element is not visible") |
| 402 | |
| 403 | if self._page.scroll_into_view: |
| 404 | await element.scroll_into_view_if_needed(timeout=timeout) |
| 405 | |
| 406 | x, y, width, height = bounding_box["x"], bounding_box["y"], bounding_box["width"], bounding_box["height"] |
| 407 | if not any(position.values()): |
| 408 | x, y = x + width // 2, y + height // 2 |
| 409 | else: |
| 410 | x, y = x + position["x"], y + position["y"] |
| 411 | |
| 412 | for modifier in modifiers: |
| 413 | await self._page.keyboard.down(modifier) |
| 414 | |
| 415 | await self._page.mouse.move(x, y) |
| 416 | |
| 417 | for modifier in modifiers: |
| 418 | await self._page.keyboard.up(modifier) |
| 419 | |
| 420 | async def type(self, selector: str, text: str, delay: Optional[float] = 200.0, no_wait_after: Optional[bool] = False, timeout: Optional[float] = None, strict: Optional[bool] = False) -> None: |
| 421 | element = await self.wait_for_selector(selector, state="visible", strict=strict, timeout=timeout) |
nothing calls this directly
no test coverage detected